We still don't have good models for what creates the Earth's magnetic field, but it is widely suspected that vast underground currents of molten Iron are the root.
I figured it was obviously due to molten iron moving around.

Electric fields come from charges. So do magnetic fields, but from moving charges, or currents, which are simply a whole bunch of moving charges. In a permanent magnet, the magnetic field comes from the motion of the electrons inside the material, or, more precisely, from something called the electron spin. The electron spin is a bit like the Earth spinning on its axis.
The earth contains a large amount of molten iron. It is rotating on its axis, while drifitng through space at breakneck velocity. Other local moving objects such as the Moon, Jupiter, et al will cause further fluctuations in the electric currents moving through the core.

A large magnetic field seems inevitable, considering these aspects.