> I don't think we know exactly what gives a body a magnetic field, or how it is maintained, but rotation seems to be important.
The magnetic field on Earth is caused by electrical currents flowing in the rotating molten metal of the outer part of our planet’s core. You’re right, rotation is an important factor.