As a child Hanuman was very mischievous. In his play he would turn the sages' ashrams upside down. Fed up, the sages cursed him: you will forget your powers, and you will remember them only when someone reminds you.
This curse also became a blessing: Hanuman grew calm, humble and eager to learn. He asked Surya, the sun god, to be his guru. Surya said that he could not stop even for a moment.
So Hanuman faced the sun's chariot and moved backwards across the sky as it travelled, learning the Vedas, the scriptures, grammar and every branch of knowledge. As his guru's fee, Surya asked him to become the minister and protector of his son Sugriva.