As Fanny says, you've managed to backfeed to ignition somehow, either through incorrect wiring or something along those lines.
The ignition light is grounded by the alternator when the engine is stopped, and when the ignition is on this gives a circuit to light the lamp.
When the alternator is running it generates a little above battery voltage so the ignition light has 12|V one end and 12V the other so it goes out.
To come on with the ignition turned off suggests that the ignition circuit is become live through something other than the switch.
Peter