Hindu Mythological ancedotes state that there used to be a demonic devil named Tanjan. Neelamegha Perumal, Lord Vishnu's avatar killed that giant at Thanjavur to restore peace and humanity. The city of Thanjavur is believed to have derived its name from this demon. The city rose to prominence during the rule of Chola monarch King Vijayala chola who made it the head quarters of Chola dynasty. After the fall of Chola dynasty, the city was ruled by a number of dynasties like Pandyas, Nayaks, Marathas and the British. The administrative powers of Thanjavur were given over to British empire under the signed treaty of 1799. British records refer the city as Tanjore.
Thanjavur attained prominence under the Chola rulers who were paramount in South India during 9th to 12th centuries. They were not only excellent rulers but also mighty builders, who erected a large number of exquisite temples in their empire, some of which constitute the finest specimens of architecture. Hence the district stands distinguished in the state even in its large number of temples, whose legends extend deep into early historic times. Many of these temples reflect the power, genius and architectural grandeurs of their authors displaying the unique and magnificent proficiency in sculpture, painting and wood carving. Art gallery the great Saraswathi Mahal library, the 'Sangeetha Mahal' (hall of music), the thriving of classical music and dance known as 'Bharathanatyam' and the celebration of grand annual music festival at Thiruvaiyaru, in honour of the great Saint Thiagaraja, all bear testimony to the cultural heritage.
The period of Chola Kings was not only considered as epoch-making but also an era of the cultural renaissance. Thanjavur under the Chola rulers was the cradle of Tamil Culture. Literature and civilisation and the rare Tamil manuscripts in the Thanjavur library corroborate this fact. Another notable feature is that in spite of several alien invasions, onslaughts and internal conflicts, the ancient culture and civilisation have not suffered much devastation. The inhabitants have successfully concentrated their histrionic talents in the field of art, literature, drama, music and dancing and are known for their rich cultural and religious fervour. They live in close harmony as a well knit community and the three main religious groups viz., Hindus, Muslims, and Christians, celebrate their fairs and festivals with a sense of mutual respect. On festive occasion, the Hindu devotees out-number all other participants in the shrines belonging to other religions. Similarly, in the case of some Hindu festivals, the temples are thronged by a substantial number of persons belonging to other religious group as well, who have a staunch faith and come in full reverence to pay homage to the presiding deities.
The beginning of the 13th century, the Chola dynasty became extinct and it gave way to Pandyan supremacy.
The Pandiyan regime was short lived. When the Pandiyan Kingdom was in the thrones of civil war, the muslim ruler Ala-Ud-Din Khiliji, the Sultan of Delhi, took advantage of it and over powered the Pandiyas. Thanjavur then came under the muslim rulers.
Thanjavur remained under the supremacy of the Vijayanagar Kings for a long period. The Nayak dynasty was established during this period and Sevappa, the founder of Nayak Kingdom of Thanjavur made his appearance on the scene (1532-1560). In 1560, Sevappa Nayak made over kingdom to his son Achuyutappa Nayak. His rules unlike that of his father was not one of unbroken peace. Shortly after getting old he abdicated the crown in favour of his son Ragunatha (1600-1630) During his reign, a Danish settlement was established at Tranquebar (1620). The Nayaks of Thanjavur were loyal to Vijayanagar after the battle of Talikotta and helped Vijayanagar in repulsing the attacks of the Nayak of Madurai and their temporary ally Golkonda, but the beginning of the 17th Century was the end of the Vijayanagar empire.
The Marattas also came to Thanjavur in the later half of the 17th century. Ekogi became the first Maratta ruler of Thanjavur (1676-1683). The Marattas ruled Thanjavur for some time but became later vassals of the Mughal Governor of Karnataka. Subsequently there were hostilities between the Arcot Nawab and the Maratta ruler of Thanjavur. The French and English also began interfering in the internal affairs of South India. The supremacy of the English was later established. Saraboji II the adopted son of Tuljaji, was made King of Thanjavur in 1798, after agreeing with all the conditions laid down by the British Government. A pact was signed between the Maratta ruler and the English by virtue of which the status of the Raja was reduced to a mere vassal.
The administration of Thanjavur was given over to English fully under the Treaty of 1799. The ruler of the Thanjavur was allowed to retain the fort of Thanjavur only with limited power of administration. When the ruler died in 1841 without heir, the Thanjavur fort was also annexed by the British and it became part of the then Madras, Thanjavur remained under the British until 1947 when India attained freedom.