Hanuman is the son of Vayu, the god of the wind, and Anjana, a celestial nymph. Anjana once angered a sage who then cursed her to be reborn as a monkey. When Anjana pleaded, and begged for forgiveness, the sage calmed down and then he reduced his curse and said that although she will be born as a monkey, she would regain her original form after she bore a son. He also said that her son will be powerful and earn great respect.
On the other hand, somewhere far away in Himalayas, Lord Shiva and Parvati decided to play games in the snow-clad mountains in the Himalayas as monkeys and hence transformed themselves into monkeys. During their stay at the Himalayas as monkeys, Lord Shiva’s seed impregnated Parvati. But as they were in the form of monkeys, the child they bore would be a monkey. Thus not going against nature and also keeping the child alive, Lord Shiva looked around for help. In the snow clad mountains, he found nobody else except Vayu deva.
Lord Shiva instructed Vayu deva to take the egg from Parvati’s womb and deposit it in someone else. Vayu deva immediately thought of Anjana who was praying for a male child and thus deposited the egg in her. Being a part of Lord Shiva, the child was ought to be very powerful. Thus Anjana got pregnant and bore a child who was very strong, powerful and monkey like!