As per known legend, when Hanuman tried to devour the Sun, darkness started prevailing everywhere. In the rescue of Sun, Lord Indra struck Hanuman from his weapon Vajra. Hanuman was hit by Vajra on his jaw (Hanu in Sanskrit). As a result, his jaw got disfigured or inflamed. That is how he got the name “Hanuman” which means – one with a prominent or disfigured jaw.
As per Bhavishya Purana, Hanuman, in his childhood mistook the Sun as fruit and flew towards it to devour it, which resulted in the darkness all over. Seeing this, Ravan, the demon king tried to free the Sun by taking hold of Hanuman’s tail but, Ravan hustled a lot and he got hung himself. But still, Hanuman did not release the Sun from his mouth.
After that, a ferocious fistfight took place among Hanuman and Ravan for a whole year. In the end, Ravan succumbed and tried to escape. But Hanuman did not leave him. At this moment Sage Vishrava (Ravan’s father) came to the scene and appeased Hanuman by reciting Veda Mantras. Then Hanuman got pleased and let Ravan go.
After this incident, Maruti was called as “Hanuman” because he tried to hit (Hanan in Sanskrit) Ravan with his fists.