The Pundarikakshan Perumal Temple is believed to have been built by the Pallavas, based on inscriptions found in two rock-cut caves at the site. These inscriptions date back to the periods of Nandivarman II (732–796 AD) and Dantivarman (796–847 AD), with construction likely completed during Dantivarman's rule.
Vaishnavism spread widely due to the influence of the Alwars, the Vaishnava saints of the 7th–9th centuries, who were supported by the Pallava kings. According to tradition, Lord Vishnu, in the Ocean of Milk, praised Mother Mahalakshmi and offered her a boon. She expressed a desire for a greater right in the Milk Ocean, but Vishnu advised her to come to Earth to receive it during the time of Emperor Shibi.
Emperor Shibi, who was fighting demons, encountered a troublesome white swine that he couldn't capture. He met sage Markandeya, who explained that the swine was actually Lord Vishnu in disguise and advised the emperor to perform a special ritual. Following the sage's guidance, the emperor successfully sought the Lord's blessing. Vishnu transferred the rights of the place to Mahalakshmi and would remain only as an idol.
Sage Markandeya told the emperor that Vishnu was already on a mission as Lord Rama and advised him to return to his kingdom. Despite reluctance, the emperor built the temple and brought 3,700 families to perform the rituals. When one family member died, Vishnu ensured that the number remained at 3,700. In the temple, Mother Sengamalavalli resides in the sanctum sanctorum and leads the festival processions in a palanquin.