The compass errors from true North because of magnetic declination. It points to magnetic North, which is the Earth's magnetic south pole located near the geographic North Pole, due to the orientation of Earth's magnetic field.
During the age of discovery, mariners found that the compass did not point to the true North because of magnetic declination. The compass points to magnetic North, not to be confused with the geographic North Pole. The magnetic North pole of Earth is located in the Arctic but not coincident with the geographic North Pole.
Instead, the north pole of a compass needle is attracted to the Earth's magnetic field's north pole, which, if we think of Earth as a bar magnet, is actually Earth's magnetic south pole. Hans Oersted's discovery that an electric current could cause a magnetic force, along with the behavior of compass needles in Earth's magnetic field, helped in understanding this concept.
The magnetic North is in constant motion due to changes in Earth's magnetic field; however, when discussing a stationary case, such as a compass in the hands of someone at the prime meridian, it would point towards the current location of Earth’s magnetic North. As one flies west along the equator, the compass needle would remain pointing toward magnetic North, indicating direction relative to the Earth's magnetic field which changes as you move around the globe, not the plane's movement. This characteristic is crucial for navigation.