Why did Hanuman try to eat the sun?

One morning, baby Hanuman saw the rising sun and thought it was a ripe fruit. He leapt into the sky to catch it.
Indra, king of the gods, struck him down with a thunderbolt and broke his jaw. Hanu means jaw. That is how he got his name.
His father, the wind god Vayu, was heartbroken, and stopped blowing. The whole world began to choke.
To make peace, the gods blessed the child. No weapon would ever kill him.
Source: Valmiki Ramayana. Episodes found only in later retellings are marked as such.