Here's why:
* The outer core is liquid: It's made of molten iron and nickel, constantly moving and swirling.
* Convection currents: Heat from the Earth's inner core drives these movements, creating electric currents within the molten metal.
* Dynamo effect: These electric currents, coupled with the Earth's rotation, generate a magnetic field. This process is called the dynamo effect.
Think of it like a giant, constantly churning electric generator at the heart of our planet!