Cain kills Abel because he is jealous, jealous that his brother’s offering to God is accepted and his isn’t.
God knows what Cain is thinking — and urges caution. God directly tells Cain that he must rule over his sinful thoughts, the temptation to do wrong. But Cain doesn’t heed God’s advice and kills his brother.
The resulting murder may have been an act of rage or merely an extreme way of eliminating the competition. But either way, Abel ends up dead and Cain has blood on his hands.
Thousands of years later, when Jude advises followers of Jesus to avoid “the way of Cain,” he might be referring to murder or perhaps a jealousy that could lead to murder, but I suspect the warning is for something much more subtle.
I think when Jude says we need to avoid the way of Cain, he means we need to control our thoughts and desires to do wrong — a warning we all need to heed.