After Ashwattama killed the sleeping sons of the Pandavas, Krishna cursed him to be immortal (chiranjeevi) and wander in pain and suffering for 3000 years. This was punishment for his terrible sin of killing children, which went against all rules of righteous warfare.