Here there are three temples situated in three different compounds adjacent to each other, however the three are considered as one Divya Desham. All three temples are located in Tanjavur. The legend is in Thretha Yuga, an Asura by the name Sri Thanjakan along with his two brothers Dandhakan and Gajamukhan did penance for Lord Sri Shiva and prayed for Saga Varam (immortality). Sri Shiva replied that he cannot grant any such boon and asked them to pray to Lord Sri Vishnu. During the tenure of Sage Sri Parasharar, famine occurred in this place. Water was available only in a small tank near the Hermitage of Sri Parasharar. Thanjakan attacked Parasharar to get water, whereupon Lord Sri Vishnu came and killed Thanjakan. Before dying Thanjakan repented for his act and became a Vishnu Bhakta and obtained Mukthi after which, this place came to be known as Tanjavur. His brother Gajamukhan took the form of an elephant and was killed by Lord Sri Vishnu assuming the form of Narasimha (Yali) so this temple was known as Thanjaiyali. Thereafter the third brother attacked Lord Sri Vishnu and was killed by Varaha.
Thanjai Mamani Koji: The Moolavar is Sri Neela Megha Perumal in a sitting posture facing east and the Thaayar is Sri Sengamalvalli.
Manikundram: The Moolavar is Sri Manikimdra Perumal in a sitting posture and the Thaayar is Sri Ambuja Valli.
Thanjaiyali Nagar: The Moolavar is Sri Narasimhan in a sitting posture facing east and the Thaayar is Thanjai Nayaki.
The legend is Sri Kubera requested Sri Vishwakarma to build a city at this place, which he constructed in the shape of Garuda flying. It is believed that Lord Garuda is protecting this city and its people need not fear serpents. Earlier, these three temples were in different places, but later on they were shifted to one place, by the Nayakar Kings. The river flowing through this city is called Vennar. It is believed that the river Virajanadhi flowing in Deva Logam came here and was named Vinnar (Heaven) and later became known as Vennar. Boothathazhwar, Nammazhwar, and Thirumangai Azhwar have sung in praise of these three gods. The idols are facing the city of Tanjavur and hence it is considered as a protection for the city and its people.