I was wondering because in RE, the explanation is (somewhat) simple: the Coriolis effect, created by the spinning of the Earth, spins molten metal near the earth's core. Quite a bit of this metal is magnetic, such as iron, and creates one strong field with the magnetic poles roughly near the geographic poles. This theory also explains why the poles flip every so often; the fields are aligned on the axis, but not in a specific direction.
This is a CGP Grey video about runway numbers. At from 8:36 onwards, he explains this model. I can grab more sources about it, but he does a great job explaining the RE version.
But here's my question: I've seen a lot of discussion on the boards about the poles, and using compasses to track position on planes, and the magnetic field bending light, but I've yet to find the FE justification for why the poles exist. The wiki does explain how it lines up with observation, due to ring magnets, but not why it's there. Do y'all have an explanation?
(Title edited for clarity)