What creates Earth’s magnetic field?

The Earth's core works like a giant bicycle dynamo in reverse.

earth's magnetic_magnetic field