Hanuman was born to the vanaras. His mother Anjana was an apsara who was born on earth due to a curse. She was redeemed from this curse on giving birth to a son. The Valmiki Ramayana states that his father Kesari was the son of rahu, he was the King of a place named Sumeru. Anjana performed intense prayers lasting 12 long years to Shiva to get a child. Pleased with their devotion, Shiva granted them the boon they sought. Hanuman, in another interpretation, is the incarnation or reflection of Shiva himself.
As a child, believing the sun to be a ripe mango, Hanuman pursued it in order to eat it. Rahu, a Vedic planet corresponding to an eclipse, was at that time seeking out the sun as well, and he clashed with Hanuman. Hanuman thrashed Rahu and went to take the sun in his mouth.Rahu approached Indra, king of devas, and complained that a monkey child stopped him from taking on Sun, preventing the scheduled eclipse. This enraged Indra, who responded by throwing the Vajra (thunderbolt) at Hanuman, which struck his jaw. He fell back down to the earth and became unconscious. A permanent mark was left on his chin (हनुः hanuḥ "jaw" in Sanskrit), due to impact of Vajra, explaining his name. Upset over the attack, Hanuman's father figure Vayu deva (the deity of air) went into seclusion, withdrawing air along with him. As living beings began to asphyxiate, Indra withdrew the effect of his thunderbolt. The devas then revived Hanuman and blessed him with multiple boons to appease Vayu.
Sources & References: https://en.wikipedia.org/wiki/Hanuman