Cain was murdered by his grandson Lamech in the latter's bid to become the top dog of the time:
"Then Lamech said to his wives: 'Adah and Zillah, hear my voice; wives of Lamech, listen to my speech! For I have killed a man for wounding me, even a young man for hurting me. If Cain shall be avenged sevenfold, then Lamech seventy-sevenfold.'" - Gen. 4:23-24
The English translations fail to properly render Lamech's words the way they should have, but the point of Lamech's proverb was that he wanted everyone to know that he was willing to kill whoever got in his way of ruling the Pre-Flood world. It's pretty ironic and poetic that Cain himself was the victim of a lifestyle that he created and cultivated.
That's not what it says! Genesis 4:17-18 (WEB):
(17) Cain knew his wife. She conceived, and gave birth to Enoch. He built a city, and called the name of the city, after the name of his son, Enoch.
(18) To Enoch was born Irad. Irad became the father of Mehujael. Mehujael became the father of Methushael. Methushael became the father of Lamech.
So Lamech was not Cain's grandson, he was his great-great-great-grandson! (Cain -> Enoch -> Irad -> Mehujael -> Methushael -> Lamech.)
It also does not say that Lamech killed his great-great-great-grandfather/Cain. It just says a "young man", which Cain would not have been at that time. Cain was 70 years old when he had his first son Enoch, Enoch was 65 when he had Irad, who was 162 when he had Mehujael, who was 65 when he had Methushael, who was 187 when he had Lamech. So when Lamech was born Cain was 549 years old - hardly a candidate to be called "a young man" by Lamech some years later! (Ages taken from the Cambridge Bible Notes.)