earth's magnetic field is generated by

gravitational forces at the poles

exchange of gases at the poles

the movement of electrical charges inside earth

chemical reactions in the van allen radiation belt