Legend has it that once Parvati, the consort of Shiva was cursed to become dark like Kali. She wanted to expatiate herself from the sin by doing penance under the temple's ancient Mango tree near Vegavathi river. In order to test her devotion Shiva sent fire on her. Goddess Parvati prayed to her brother, Vishnu, for help. In order to save her, he took the Moon from Shiva's head and showed the rays which then cooled down the tree as well as Parvati. Shiva again sent the river Ganga (Ganges) to disrupt Parvati's penance. Parvati Request to Ganga and convinced her that both of them were sisters and so should not harm her. Subsequently, Ganga did not disturb her penance and Parvati made a Shiva Linga out of sand to get united with Shiva. The God here came to be known as Ekambareswarar or Lord of Mango Tree.