After Kayin kills Hevel, Hashem comes to Kayin and says (BeReishit 4:9), “Ei Hevel Achicha,” “Where is Hevel, your brother?” to which Kayin responds, “Lo Yadati HaShomer Achi Anochi,” “I don’t know; am I my brother’s keeper?” This is usually interpreted as Kayin talking disrespectfully to Hashem. Hashem then responds angrily and punishes Kayin, and only by the mercy of Hashem and a last minute Teshuvah by Kayin is he spared.
However, there is another way to interpret this more positively for Kayin. In the beginning of Perek Daled, the Torah states that Chavah gave birth and said, “Kaniti Ish Et Hashem,” “I have acquired a man with Hashem” (4:1). This can have two interpretations: The first (Rashi’s) is that Chavah was saying, "I was created solely by Hashem, but now I (with Adam) am creating another man as a partner Hashem," referring to her newborn son. The second is that Adam had been angry with Chavah after their expulsion from Gan Eden and left her. Once she gave birth to Kayin, Adam came back to her to raise Kayin. This caused her to say this line in reference to Adam; this makes Kayin seem like no more than a peace offering, used only to bring his parents together again. If this was the case, it is understandable to believe Kayin may have been neglected as a child. When he gets older, Kayin brings a Korban of flax (see Rashi), some of his produce. He doesn't know if this is a good Korban or not because there has been no precedent. He seems to be struggling for attention, because he isn't necessarily getting very much from his parents. He is then one-upped by his younger brother, who brings a sheep. This hurts Kayin, because Hashem accepts Hevel's offering over Kayin's, and as the older brother, he feels as if the younger sibling, Hevel, always receives the most parental attention, but now even Hashem is preferring Hevel over Kayin! Hashem tells Kayin that he shouldn't be upset, but he still wants to one-up his brother in return.
Kayin subsequently kills Hevel. When we contemplate this story, we realize that Hevel's Korban was closer to the completion of creation, from that which was made on the sixth day, then Kayin's was, as his was from the third day. We can then potentially realize a progression in the process. There has never been a human death before, so Kayin is unaware of potential punishment. Kayin feels as if he can surpass his brother's Korban by offering the one thing that came later in creation than the sheep: a person. After Kayin sacrifices his brother, Hashem realizes that Kayin doesn't recognize that he did something wrong, and tries to communicate this point to him gently. He asks him (4:9), “Ei Hevel Achicha,” "Where is Hevel, your brother?" Once Hashem says this, Kayin realizes that he did something wrong, because the last time Hashem had spoken to anyone was when Adam and Chavah were kicked out of Gan Eden. He then realizes and replies, not, “I don't know, am I my brother's keeper?” as a rude question, but "I didn't know that I am my brother's keeper," as a realization of the job that older siblings have: they are responsible to protect the little ones who come after them. Hashem then confirms that he has done something wrong, and Kayin does a heartfelt Teshuvah. And even though Hashem still has to punish him, Kayin is not killed; he is handled in a much more productive manner – subject to wandering civilization with his Ot, he is then a living sign for everyone to realize the proper relationships of a family.