One night he saw an owl attacking crows, and in the morning, the situation was reversed, when crows attacked the owl. Inspired by this incident, he attacked the Pandavas during night and beheaded all Pandavas, but they were Upapandavas, or five sons of Draupadi.
Ashwatthama also used Brahmastra to destroy all pandavas and Arjuna and Krishna intervened. He did not know how to retrieve this, directed this towards the womb of Uttara (wife of Abhimanyu) who was carrying Abhimanyu’s son (Parikshit). This was an attempt to end the lineage of the Pandavas. Krishna used his sudarshan chakra to stop the Brahmastra and save Uttara’s unborn child who later was known as Pariskshit.
Due to above misdeeds, Krishna cursed him to suffer and carry the burden of all people’s sins on his shoulders and will roam alone like a ghost without getting any love and courtesy till the end of Kaliyuga. A gem or mani which was on his forehead was also taken from him. This is believed that Ashwatthama will be freed by Kalki-Avatar, the tenth incarnation of Sri Krishna.
In Hindu mythology or Indian mythology and especially in the epic Mahabharat, we can find many instances of misdeeds, and also see that the power is bestowed to the people who can misuse it. For example, the Brahmastra was in wrong hands. How relevant this is today as we see that nuclear weapons do not necessarily kept by good people only. Similarly we find similar instances in World mythology as well.
Only history will tell who is wrong and who is right as in the case of Ashwatthama, who thought he was avenging the wrong doing of Pandavas, but if we look at the bigger picture, we find that this is not the case. But Lord Krishna knew this, didn’t he?