Ravana’s lineage can be traced back to the mighty Lord Brahma. His grandfather was Sage Pulastya, one of the ten mind-born sons of Brahma. This made Ravana the great-grandson of Brahma.
There is actually a very interesting story behind the birth of Ravana and his brothers. The demon King Sumali once spotted Kubera, the son of Sage Vishrava, in his golden flying chariot. He wanted his daughter Kaikesi to have mighty children like Kubera, and so, he instructed her to obtain sons through Vishrava. Obeying her father’s command, she approached Sage Vishrava when he was offering prayers. Though Visharva obliged to her request, he warned her that all her sons, except the youngest one, would turn out to be evil and wicked because she had approached him at the wrong hour. Kaikesi ignored this remark and gave birth to Ravana, Kumbakarna, Surpanaka, and Vibhishana. Thus, Ravana came to be half-asura and half-brahmin.
Kaikesi was extremely proud of her arrogant sons. Motivated by greed, she asked Ravana to take over the kingdom of Lanka, which was being ruled by her step-son Kubera. Ravana and his brothers performed penance at Gokarna for several years to please Brahma. Ravana went so far as to sacrifice each of his heads in the holy fire to please the creator. Right before he was about to chop off his tenth head, Brahma appeared to grant him a boon. Ravana asked for the boon of immortality. Brahma said that was not possible as all that is born has to perish. So Ravana tweaked his wish.
“O mighty Brahma, may I never obtain death at the hands of Devas, Asuras, Yakshas, Gandharvas, Rakshasas, and Nagas.”
Because of his pride, Ravana did not mention humans as he didn’t consider them to be a threat. Brahma restored his heads and gave him the boon. After achieving near invincibility, Ravana marched towards Lanka and defeated Kubera. Paying heed to his father’s advice, Kubera vacated his city and headed to Kailasa. Days passed and Kubera felt terrible at hearing about Ravana’s misbehaviour towards his people and sent overtures advising him to stop being cruel. Ravana was furious at Kubera’s impertinence and waged war on Kailasa, defeating Kubera once more. He also took away Kubera’s golden chariot, the fabled pushpaka vimana which had the power to travel at the speed of thought and would also obey its rider’s commands.