Because the Earth's true north pole and its magnetic north pole are in different places.
See the attached picture that I whipped up for you.
A compass points east or west of true north due to the difference between magnetic north and true north. Magnetic north is influenced by the shifting of the Earth's magnetic poles, causing a deviation called magnetic declination. This means that depending on your geographical location, a compass needle may not align perfectly with true north.
;