The history of Tiruvannamalai revolves around the Annamalaiyar Temple. The recorded history of the town dates back to the ninth century, as seen from a Chola inscriptions in the temple. Further inscriptions made before ninth century indicate the rule of Pallava kings, whose capital was Kanchipuram. The seventh century Nayanar saints Sambandar and Appar wrote of the temple in their poetic work, Tevaram. Sekkizhar, the author of the Periyapuranam records both Appar and Sambandar worshiped Annamalaiyar in the templeThe Chola Kings ruled over the region for more than four centuries, from 850 to 1280, and were temple patrons. The inscriptions from the Chola king record various gifts like land, sheep, cow and oil to the temple commemorating various victories of the dynasty.
The Hoysala kings used Tiruvannamalai as their capital beginning in 1328 There are 48 inscriptions from the Sangama Dynasty (1336–1485), two inscriptions from Saluva Dynasty, and 55 inscriptions from Tuluva Dynasty (1491–1570) of the Vijayanagara Empire, reflecting gifts to the temple from their rulers. There are also inscriptions from the rule of Krishnadeva Raya (1509–1529), the most powerful Vijayanagara king, indicating further patronage. Most of the Vijayanagara inscriptions were written in Tamil, with some in Kannada and Sanskrit. The inscriptions in the temple from the Vijayanagara kings indicate emphasis on administrative matters and local concerns, which contrasts the inscriptions of the same rulers in other temples like Tirupathi. The majority of the gift related inscriptions are for land endowments, followed by goods, cash endowments, cows and oil for lighting lamps. The town of Tiruvannamalai was at a strategic crossroads during the Vijayanagara Empire, connecting sacred centers of pilgrimage and military routes. There are inscriptions that show the area as an urban center before the precolonial period, with the city developing around the temple, similar to the Nayak ruled cities like Madurai. During the 17th century, Tiruvannamalai came under the dominion of the Nawab of the Carnatic. As the Mughal empire came to an end, the Nawab lost control of the town, with confusion and chaos ensuing after 1753.Subsequently, there were periods of both Hindu and Muslim stewardship of the temple, with Muraru Raya, Krishna Raya, Mrithis Ali Khan, and Burkat Ullakhan besieging the temple in succession. As European incursions progressed, Tiruvannamalai was attacked by French Soupries, Sambrinet, and the English Captain Stephen Smith. While some were repelled, others were victorious. The French occupied the town in 1757 and it came under the control of the British in 1760. In 1790,