Earth's magnetic field comes from moving liquid metal
Below Earth's solid surface is an outer core made of liquid iron that can carry electric current. Heat and other forces keep this metal moving. Its motion creates electric currents that keep Earth's magnetic field going.