As per Hindu legend, King Indrajuman, who immersed himself in the worship of Lord Vishnu, failed to strengthen his army and lost his kingdom. While doing worship, he also did not observe the sage Durvasa (some sources claim it as Agasthya) who went along his way. The sage got irritated and cursed the king to be born as an elephant in his next birth. The king apologized to the sage for his negligence and moved by his innocence, the sage wished that he would continue to be a Vishnu devotee as an elephant and that Vishnu would bestow him goodwill. He was cursed by a sage to be born as crocodile in his next birth. The elephant Gajendra continued as a Vishnu devotee and while drinking water from the temple tank, his leg was grabbed the crocodile. The elephant cried in rescue calling the name "Adimulam" and Vishnu sent his discus to fend off the crocodile. Both the elephant and crocodile turned to their human form by the grace of Vishnu. Since Vishnu appeared heard to save the elephant Gajendra, he came to be known as Gajendara Varadar.