A compass points north because all magnets have two poles , a north pole and a South Pole. It is like when you have to magnets and you put them close together they will join but if you are under the equator the back of the needle points south.
But a magnet in a table will not point north. Because it needs to be hanged to point north because it will make it easier to try to go north.
The Compasses are used to point north so when someone is lost they can know were is north.
The compass was invented more than 2000 years ago. The first compasses were made of lodestone, a naturally magnetized ore of iron, in China between 300 and 200 BC.
The compass was later used for navigation. Later compasses were made of iron needles, magnetized by striking them with a lodestone. Dry compasses begin appearing around 1300 in Medieval Europe. This was replaced in the early 20th century by the liquid-filled magnetic compass.