Nib asked, and Nib — askNib's tutor — drew the answer live at a whiteboard. This is the spoken transcript; enable JavaScript to watch it drawn.
why does the earth have a magnetic field
Everyone draws Earth as a giant bar magnet, with a magnet buried inside. It is a handy picture of the field, but it is not why the field exists.
Iron loses its magnetism above 770 degrees Celsius. Earth's core is hotter than 4,000. No permanent magnet survives there, so something must keep making the field.
The real story is in the core: a solid inner ball of iron, wrapped in a thick layer of liquid iron and nickel, hotter than 4,000 degrees.
Heat leaks out of the core. Hot liquid iron rises, cooled liquid sinks, and the whole outer core churns like a pot on the stove.
Earth also spins once a day. That spin twists the rising and sinking streams into long spirals lined up with the spin axis, and organizes the chaos.
Now the loop. Liquid iron conducts electricity. Moving through a magnetic field, it makes an electric current, and that current makes a stronger field. It feeds itself.
So the field is a machine, not a magnet: heat drives the churning, spin organizes it, and the loop sustains it. It even flips, last about 780,000 years ago.
Deep under your feet, a sea of liquid iron is quietly running a generator that has shielded Earth for billions of years.