Here's why:
* The outer core is liquid: It's made primarily of iron and nickel, which are excellent conductors of electricity.
* Convection currents: The intense heat from the Earth's inner core drives convection currents within the outer core, causing the liquid metal to move and swirl.
* Electric currents: This movement of electrically conductive material generates electric currents, which in turn produce a magnetic field.
It's like a giant, natural dynamo! This magnetic field extends far beyond Earth's surface, creating the magnetosphere that protects us from harmful solar radiation.