There are two aspects of Cain’s offering, which found him unapproved before God: (1) his attitude and (2) the type of offering.
Eventually, Cain and Abel came before God with their offerings. “Cain brought to Jehovah an offering of the fruit of the ground.” (Gen. 4:3) “Also brought of the firstlings of his flock and of their fat portions.” (Gen. 4:4) It is likely that both Cain and Abel were close to 100 years old at the time, as Adam was 130 years old when he fathered his third son, Seth.―Genesis 4:25; 5:3.
We can establish that the two sons became aware of their sinful state, and sought our God’s favor. How they garnered this knowledge is guesswork, but it is likely by way of the father, Adam. Adam likely informed them about the coming seed and the hope that lie before humankind. Therefore, it seems that they had given some thought to their condition and stand before God, and realized that they needed to try to atone for their sinful condition. The Bible does not inform us just how much time they had given to this need before they started to offer a sacrifice. Rather, God chose to convey the more important aspect, each one’s heart attitude, which gives us an inside look at their thinking.
Some scholars have suggested that Eve felt that Cain was the “seed” of the Genesis 3:15 prophecy that would destroy the serpent, “she conceived and bore Cain, and said, ‘I have gotten a man with the help of Jehovah.’” (Gen. 4:1) It might be that Cain shared in this belief and had begun to think too much of himself, and thus the haughty spirit. If this is the case, he was very mistaken. His brother Abel had a whole other spirit, as he offered his sacrifice in faith, “By faith Abel offered to God a more acceptable sacrifice than Cain, through which he was commended as righteous, God commending him by accepting his gifts.”―Hebrews 11:4.
It seems that Abel was capable of discerning the need for blood to be involved in the atoning sacrifice, while Cain was not, or simply did not care. Therefore, it was the heart attitude of Cain as well. Consequently, “but on Cain and his offering he did not look with favor. So Cain was very angry, and his face was downcast.” (Gen 4:5, NIV) It may well be that Cain had little regard for the atoning sacrifice, giving it little thought, going through the motions of the act only. However, as later biblical history would show, Jehovah God is not one to be satisfied with formal worship. Cain had developed a bad heart attitude, and Jehovah well knew that his motives were not sincere. The way Cain reacted to the evaluation of his sacrifice only evidenced what Jehovah already knew. Instead of seeking to improve the situation, “Cain was very angry, and his face fell.” (Gen. 4:5) As you read the rest of the account, it will become clearer as to the type of temperament Cain had before Jehovah God.
Genesis 4:6-16 Updated American Standard Version (UASV)
6 Then Jehovah said to Cain, “Why are you angry, and why has your face fallen? 7 If you do well, will there not be a lifting up? And if you do not do well, sin is crouching at the door. Its desire is for you, but you must rule over it.”
8 Cain said to Abel his brother. And it came about when they were in the field, that Cain rose up against Abel his brother and killed him.
9 Then Jehovah said to Cain, “Where is Abel your brother?” And he said, “I do not know. Am I my brother’s keeper?” 10 He said, “What have you done? The voice of your brother’s blood is crying to me from the ground. 11 Now you are cursed from the ground, which has opened its mouth to receive your brother’s blood from your hand. 12 When you cultivate the ground, it will no longer yield its strength to you; you will be a fugitive and a wanderer on the earth.” 13 Cain said to Jehovah, “My punishment is greater than I can bear! 14 Behold, you have driven me today away from the ground, and from your face I shall be hidden. I shall be a fugitive and a wanderer on the earth, and whoever finds me will kill me.” 15 So Jehovah said to him, “Therefore whoever kills Cain, vengeance will be taken on him sevenfold.” And Jehovah put a mark on Cain, so that no one finding him would slay him.
16 Then Cain went out from the presence of Jehovah, and dwelt in the land of Nod, east of Eden.
 Adam’s family must have received God’s revelation about the necessity of sacrifice to create and maintain fellowship with God. The background to this was probably the sacrifice that God performed to provide the clothing to cover Adam and Eve’s shame (see Gen. 3:21). Anders, Max; Gangel, Kenneth; Bramer, Stephen J. (2003-04-01). Holman Old Testament Commentary – Genesis: 1 (p. 56). Holman Reference. Kindle Edition.
 Or, his countenance fell
 This is a shortening of the Hebrew idiom “to lift up the face,” which means “to accept” favorably
 The Tetragrammaton, God’s personal name, יהוה (JHVH/YHWH), which is found in the Hebrew Old Testament 6,828 times.
 I.e. wandering