It is believed that the first mechanical clock was invented in 723 or 725 A.D. by Chinese mathematician and monk Yi Xing, also spelled I Hsing. Rudimentary clocks existed prior to that in Europe, but they did not have the escapement mechanism that is characteristic of mechanical clocks.
Xing used his invention to keep track of celestial activity and called it "Water-Driven Spherical Birds-Eye View Map of The Heavens." Early clocks like Xing's lasted only a few years before the water in the mechanism caused the metal to corrode. Later clocks used mercury, which was safe for use with iron and bronze mechanisms without causing corrosion.