As per Hindu legend, a son of Brahma named Karthama Prajapathi did penance worshipping Vishnu to attain Moksha. Vishnu was not pleased and Lakshmi, his consort was not convinced with Vishnu testing Karthama. She hid herself in the lotus tank at this place. Vishnu came in search of her and after finding her, he took her to Vaikunta. It is believed that Vishnu is sported in hugging posture in the nearby Thirungari also on account of the legend. Karthama took many births during various ages like Treta Yuga and Dwapara Yuga, but Vishnu told him that he would get Moksha only during Kali Yuga. During Kali Yuga, Karthama was born as prince Sangabalan. During his young age, he wanted to marry Kumudavalli. She was an ardent devotee of Vishnu and stipulated that she would marry him only if he feeds thousand Vaishnavites, the devotees of Vishnu. Sangabalan started feeding the devotees and he also resorted to burglary to fund it. Vishnu came with Lakshmi incognito in his path and he tried to rob them as well. Vishnu uttered the Ashtatra Mantra in his ears and he turned into Thirumangai Azhwar. Since Vishnu in the form of Ranganatha gave darshan to the Azhwar and his wife, the presiding deity is called Kalyana Ranganatha. The place is locally called Azhwar Koil and also called Vedarajapuram.