The Bodhisatta was once Indra, king of the gods. An ascetic who lived in the Himalayas adopted an elephant calf and treated it as a son. One day it got sick from eating too much grass, and while the ascetic went to the forest to get it some fruit as a cure, the elephant died. The ascetic became depressed, and when the Bodhisatta noticed this he came down to Earth and floated in the air, telling him that his sorrow was improper. This reminded the ascetic about the impermanence of all things, which restored his happiness.
In the Lifetime of the Buddha
The ascetic and the elephant were earlier births of one of the Buddha’s elder disciples and a novice under his guidance. The elder was overcome with grief after the novice got sick and died. When the Buddha heard some other disciples discussing the elder’s sorrow, he told them this story so they knew this was not the first time the elder had lost control of his emotions and lamented the death of someone in his care.