What generates our planet's magnetic field?

Three things:

  1. The planets rotation.
  2. The energy lost as the planet cools
  3. Both of the above driving movement of the molten iron in the core of the planet.