You get a egg regardless if you get it from yourself, breeding hacked Pokemon, or trading to get an egg. They will still result in normal Pokemon.
To get a bad egg, this is when the action replay starts to take place. When you type in a code to receive any Pokemon you want (Gen V and lower), you start up the game and the bad egg would take place. Normally, they say press "Start" to create your Pokemon egg. When the egg comes out, it says bad egg. To know if something is a bad egg, you can take any amount of steps you want, and it wont hatch when it says "OH!". It normally takes 1 step each time (annoying). Some Pokemon activate if you re "START" the egg, but not necessarily.
I don't actually know on how to receive a bad egg in X and Y though.
Hope I helped! :)