The elephant Gajendra and the crocodile were actually gandharvas in their previous birth. Due to a curse one was born as an elephant and the other a crocodile. Both the souls were great devotees of Lord Narayana as gandharvas and the devotion continued even in their rebirth as an animal. The episode of the crocodile catching the elephant's leg and isolating it from all help is interpreted as follows:
Both Gajendra and the crocodile were contemplating on the Lord. But as an elephant, Gajendra could express his devotion vocally and the crocodile had to be content thinking of the lord only in mind. The crocodile somehow wanted to express its devotion to the Lord and it could find no better person as the elephant devotee Gajendra and so it caught Gajendra's leg tightly. This can be symbolised as a seeker clinging on to the feet of his Guru or a devotee of the Lord clinging on and serving the feet of a prappana of the Lord. The cry of help by Gajendra to the Lord was not for only him but also for the crocodile as in reality the crocodile was only expressing his helplessness in samsara through the cry of Gajendra. Infact the cause for Gajendra's cry for help to the lord was the crocodile itself. Therefore when the Lord appeared, He first freed the crocodile from the bondage of samsara. This symbolises the love of the Lord for his devotee's devotee.
Gajendra Moksha, Pahari, Kangra, early 19th century