Hanuman is an incarnation of Shiva – Rudra avatar, partial incarnation. Ravana was one of the greatest devotees of Shiva. So there was conflict – how could an incarnation of Shiva fight the demon Ravan? When Shiva took the avatar of Hanuman, Goddess Parvati raised this question.

Shiva replies that Ravan did all penance and austerities to get boons and become powerful. He was not interested in attaining Moksha. He was interested in only spreading Adharma.

Ravana did intense tapas to please Shiva. When Shiva did not appear, he cut off his heads one by one and offered them into a sacrificial fire.

Ravana thus pleased the 10 ferocious manifestation of Rudra Shiva. But Shiva had 11 Rudra manifestations. The 11th Rudra was not satisfied by the sacrifice.

It is the 11th Rudra that incarnated as Hanuman and caused the destruction of Ravana and his demon empire.