Magnetic fields exist because physics views the Universe as three space dimensions and one time dimension. Actually, the Universe is quaternionic and contains four space dimensions, one real...
An alternator is an a.c. motor in reverse; the coils of the armature (the part that rotates) cuts through the magnetic field of the stator (the part that is stationary, which is what "stator" means)....
In short, the needle of the compass is a magnet. Because there are large deposits of iron in the far north, the magnet is attracted to them and points north.