Ashwathama, also known as Drauni is the son of Dronacharya and Kripi (sister of Kripacharya). He along with his father fought in the Kurukshetra war in Mahabharata from the Kauravas side against the Pandavas.
He is considered as a partial incarnation of Shiva and is one of the seven Chiranjivi ( immortal living beings in Hinduism who are to remain alive on Earth until the end of the current Kal Yuga. )
Ashwathama is also believed to be the living survivor of the Kurukshetra war along with his maternal uncle Kripa.
He was born with a gem (mani) on his forehead which makes him powerful than all the living beings lower than humans. It also protects him from hunger, thirst and fatigue.
Now coming to post Mahabharata war :
Ashwathama kills sons of Pandavas:
When Duryodhana was killed by Bheema (Bhima), then remaining Kauravas warriors (including Ashwathama) made a deadly attempt to kill the Pandavas brothers in the night when they would be sleeping.
On that night Krishna took all the 5 Pandavas somewhere else & Ashwathama entered into the tent of the Pandavas and mistakenly killed all the 5 sleeping sons of Pandavas and set the camp on fire.
When Pandavas returned to the camp and learned about this dreadful incident, they become inconsolable. They went searching for Ashwathama to sage Vyasa’s ashram.
On seeing Pandavas, Ashwathama as the last option devised a Brahmashirsha Astra from a blade of grass and invoked it against the Pandavas and Krishna.
Narada and Vyasa came to stop Brahmashirsha Astra used by Aswathama and Arjuna
Brahmashirsha Astra is the evolution of the Brahmastra and showered a shower of meteors to annihilate the enemy. This weapon can be invoked by using sacred mantras into any object, even to a blade of grass.
Arjuna invokes the same Astra, which he received from Drona himself towards Ashwathama.
On seeing the powerful Astra’s heading for a head-on collision that would result in the total annihilation of the entire earth, Vyasa asked both the warriors to withdraw their weapons.
Arjuna was able to withdraw this weapon, but Ashwathama could not do so because Drona did not teach his son how to withdraw it. This limits him from using this weapon for only one instance.
Instead of deviating his weapon towards an uninhabited place, where this Astra can explode harmlessly, he directed it towards the womb of the pregnant Uttara (wife of Abhimanyu – the son of Arjuna) in an attempt to end the lineage of the Pandavas.
Ashwathama cursed by Krishna:
Her son was later revived by Krishna. In this way, Ashwathama tried to kill everyone in the Pandava’s family. On this Lord Krishna became very angry with him & cursed him badly.
Ashwathama cursed by Krishna
As a punishment, Ashwatthama was asked to surrender the gem on his forehead. Krishna then cursed Ashwatthama that he will roam in the forests with blood and puss oozing out of his injuries and cry for death.
Since he had no fear of death during the war, death would not meet him. He will have neither any hospitality nor any accommodation; he will be in total isolation without any contact of physical communication from mankind and society.
The wound caused by the removal of this gem on his forehead will not heal and his body will suffer from a host of incurable diseases forming sores and ulcers that would never heal until the next avatar to Bhagwan Vishnu arrives.