Gajendr moksh is legend from Bhagavata Purana. Lord Vishnu came down to earth to protect Gajendr(elephant) from the death clutches of Makara (Crocodile).
Gajendr was the King of elephants. One hot day, he proceeded to the lake with his family to cool off in its fresh waters. But from within the lake a crocodile appeared who attacked him and would not let go of him. When the family and relatives saw 'death' coming close to Gajendra, and everyone realised that everything was lost, they left Gajendra alone. Gajendra prayed to god Vishnu to save him. Vishnu came to the aid of Gajendra, who offered a lotus to the god. Vishnu attacked the crocodile and saved His Loved One.
Gajendr, in his previous life was a great devotee called Indradyumna who was also a great king. One day, Agastya, a great sage came to visit the king. Indradyumna did not receive the Sage with the respect that the latter expected. The enraged Agastya cursed the king to become an elephant in his next birth, as he sat heavy on his seat and did not rise to greet him.
So Gajendra who was the ardent devotee of Lord Vishnu (another form of Kanha) and who use to offer lotus every day to God...when he was in trouble...Lord himself came to his rescue...Jab Jab Bhakt bhagvaan ko sache mann se pukar the hain...Bhagvaan khud bhakt ki raksha karthe hain...