China

The first mechanical clock was invented in China between 1088 and 1092 AD.

An excerpt from the article 30 facts about China

It was built by Su Song, one of the citizens. The device precisely indicated the time of day and allowed you to track constellations in the sky, so you could precisely set horoscopes.