Well basically everything Isasapiens said, and an illegal Pokemon is obtained through Action Replay, because AR simply generates the Pokemon with your ID thingy. It may have legitimate moves and ID, but its IVs and EVs are all screwed up. Classing it under illegal/banned Pokemon. They may also be obtained through a program called PokeGen (Pokemon Generator). PokeGen is a computer program that generates Pokemon data on the computer, you may choose what move the Pokemon knows, what Trainer ID it belongs to, what's it's trainer's name, IVs, EVs, items, level, all that stuff! If you make it completely absurd, like a Magikarp with Roar of Time, maxed out IVs and EVs, holding masterball, level 100; then that's way over illegal/banned Pokemon. Although PokeGen is also a method on gaining legitimate, legal Pokemon. Make all the IVs and EVs proportional to what is really is, moveset of what it can actually learn at that level, your Trainer ID and name, that stuff, then the Pokemon may be classified as a legitimate and legal Pokemon. Legal Pokemon may participate is championships, illegal may not.
Derp.