Abhimanyu’s wife Uttara was pregnant. After the war, she delivered a boy who was christened Pariksheet. When he was in the womb, he was almost killed by the Brahmastra shot by Aswathama.
Due to fear of Bhimasena & he might harm Ashwatthama in any deceitful way, he invoked the Brahmashira. Arjuna also invoked the same to counter it. Sage VyAsa asked both of them to revert their weapons to avoid excessive destruction. Arjuna obeyed, however Ashwatthama didn't know the skills to revoke it.
Harbouring grudge against PAndava-s for their certain actions during the war, Ashwatthama may have inspired to finish PAndava-s. However respecting VyAsa's order/request, he might have thought of killing the youngest PAndava -- Arjuna's grandson, who was still in womb. This will virtually wipe out the PAndava's bloodline.
PAndava's, Draupadi & Subhadra were already of elder ages as discussed here, & they may Not want any progeny from any unworthy woman, just for the sake of retaining their bloodline.
Drona's son, beholding those two rishis standing before him, could not by his energy withdraw his own terrible weapon. ... Contrived for the destruction of the Pandavas, that weapon, therefore, will take away the lives of all the sons of Pandu. ... O regenerate one, I am unable to withdraw it, having once let it off. I will now throw this weapon into the wombs of the Pandava women. [Sauptika Parva]
Above passage describes "What happened", from there we may derive the "Why happened" part as well.
This is well explained in BRC Mahabharata as well, see this video.