Story of Indra and the bird who refused to leave the tree on which it had made its abode is found in the Anusasana Parva, Chapter 5, of Mahabharata. A hunter once went hunting with poisoned arrows. One of his arrows hit a big tree and the powerful poison dried up the whole tree.
In the hollow of the trunk of the tree, there lived a bird with mystic powers. It did not leave the tree, which had been its home since birth.
One day Indra approached the bird in the guise of saint. However, the bird easily identified Indra by its mystic power.
Indra advised the bird to leave the tree and find a suitable residence as the tree could fall anytime.
The bird did not accept his advice.
Indra was pleased at the bird’s loyalty and gratitude towards the tree. Therefore, he took the bird along with him to heaven.