As per Hindu legend, there was a competition among the consorts of Vishnu namely Sridevi, Bhoodevi and Neeladevi on the degree of their devotion to Vishnu. Sridevi descended down to earth and repaired a sequestrated spot surrounded by paddy fields. She sat in devotion and influenced by her power of worship, all sages started worshipping her at the place.
Realising that living alone would be improper, she engendered a theertha (water body) and propitiated Vishnu. Pleased by her devotion, Vishnu appeared at the spot. Bhudevi and Neeladevi followed her footsteps and acceded that Sridevi was the most devoted among them. Vishnu desired and stayed (thangal in Tamil) along with his consorts in the place.
As per another legend, Krishna's grandson Anirudhha, got married at this place.
As per another legend, Ranganatha from Srirangam Ranganathaswamy temple was enamoured by the devotion of Andal. He started a journey to Srivilliputhur Divya Desam to seek her hand for marriage. While reaching the place, it became dark and he decided to spend the night in the place. Since he stayed at this place, it came to be known as Thiruthangal and the hillock came to be known as Thalagiri.
The temple finds mention in the eighth chapter of Brahmanda Purana that deals with the story of king Puroora Chakravarthy. Puroora was a righteous king of Bharathavarsha and when he became old, he gave his kingdom to his sons. He approached to sages to direct him to the right place to do penance, who directed him to Thiruthangal. After performing austere penance, Mahavishnu appeared to him.
Devendra Vallabha, a scion of Pandya dynasty was once hunting a tiger and reached Thiruthangal. While firing an arrow at the tiger, a divine voice explained the history of the tiger. In its previous birth, the tiger was a ruler by name Chandraketu, who did not adhere to the principles of doing penance. He was hence made to be reborn as a tiger. Mahavishnu appeared to both Devendra and the tiger. In commemoration of the event, the rock near the temple is named Puliparai (puli means tiger and parai indicates hill).
There was once an argument between banyan tree and Adisesha as to who would be closer to Vishnu. Brahma, the Hindu god of creation was asked to mediate and he judged in favour of Adisesha, who went on to become the serpent bed of Vishnu. Banyan tree was highly dissatisfied and he started doing intense penance praying to Vishnu at Thiruthangal.
Vishnu appeared to the banyan tree and gave him a boon that he would sit over him at Thiruthangal. The rock is thus believed to be the banyan tree and thus came to be known as Thangalgiri. Based on the legend, there is a common belief that the temple provides relief to devotees suffering from mental weariness and physical fatigue.
Ninra Narayana Perumal temple is believed to have been built by Pandyas. There are a host of inscriptions in the temple indicating information related to the gifts offered to the temple. One of the inscription from 1032 CE indicates the temples as Paramaswamy who willingly chose the hillock as his abode. A lake by name of Vallabha Pereri existed by the side of the temple. During the reign of Maravarman Kulasekara Pandyan I (1308 - 23 CE), a shrine was erected for the image of Singhaperumal (Narasimha).
The two sons of Tiruvenkatanatha, an official in the Pandyan Empire constructed the western precinct.[2] During 1220 CE, they constructed a mutt and endowed for the recitation of Ramayana, Mahabharatha and Puranas. During the reign of Maravarman Sundara Pandyan (1216–1238 CE), special poojas were instituted. In 1227, Gurukulatharaiyan, the minister of Sundara Pandyan arranged for the construction of the sanctum, Mahamandapam and Ardhamandapam.
In later periods, a lady named Tirumangai Andal installed the metal images of Karmachanai Emperuman and the Devis. The festival idols were taken out in procession during new moon day. The inscription about these inscription were recopied as the rock contained the original epigraph was shattered.
In modern times, two philanthropist, named Ramanujadasa and Narayanadasa arranged for the construction of Kalyana Mantapa, Garuda Mandapa and other Mandapas (halls).
During 1979, the northern compound wall, 120 ft by 30 ft tall collapsed due to torrential rains, which was repaired with the help of local support.
In modern times, the temple is maintained and administered by the Hindu Religious and Endowment Board of the Government of Tamil Nadu.