Very simplistic answer:
1) There will be some steel (or other magnetisable metal) in the aircraft.
2) Passing a current through magnetisable metal causes it to turn into a magnet (remember the experiments at school with a nail, battery and some wire)
3) Magnet + compass = error