The magnetic properties of the matter have been observed by people even from Antiquity. The words "magnetism" and "magnet" seems to come from the (by then) Greek region of Magnesia (now in western Turkey) or from the city of Magnessa in the same region, around which "magnetic stones" (magnetite deposits) were found, as Titus Lucretius Carus sustained. Plinius said the words come from the shepherd Magnes who encountered magnetic stones.
A certain fact is that the compass is a very ancient Chinese invention. Chinese used first the compass for traveling on land. They built the so-called "south pointing chariots" (tschi-nan-kiu). These objects were two wheeled carriages with a small statue located before the seat. The statue could rotate around an ax and had a stretched arm on which was located a magnetic bar. The arm always indicated the south. Emperors used these chariots while visiting remote regions of their vast empire. The inventor of this chariot and of the compass is considered to have been the emperor Tsche-U-Kung, which ruled around 110 BC.
Sometimes, the chariots had an upper level and, besides the statue indicating the south, there also were two statues showing the length of the route covered. On the upper level, one of these two statues always bit a gong each time one li (meaning 0.5 km or 0.3 mi) was made. At each 10 li, the second statue rang a bell.
A story says that this chariot was invented in fact by the emperor Huang-Ti, during the war against a rebel. The rebel had raised a cloud of dust to disorganize the imperial army. Huang Ti built the south pointing chariot which enabled him to orientate on the battle field and defeated the rebel. This happened around 236 BC.
Later, around 658 AD, the compass reached Japan. In Europe, the compass was brought by the Arabs.