It has been known for millennia that the Earth has a magnetic field, as though there were a giant magnet at the centre. It is for this reason that North Pole and South Pole are geographic terms.
In fact the Earth's North Pole, the true North Pole is not in the direction indicated by a magnet, for two reasons:
The north pole on a magnet is the south seeking pole. For a north pole to point north, it must be pointing towards a magnetic south pole, so the Earth's geographic north pole is actually a magnetic south pole.
The Earth's magnetic field is not aligned with it's axis. The difference between the two at the moment is about 7 degrees. In addition the Earth's magnetic field is not constant. North and south poles change polarity periodically.