Gen. 6:5 (KJV) And GOD saw that the wickedness of man was great in the earth, and that every imagination of the thoughts of his heart was only evil continually.
What a terrible thing. Mankind, whom God had created in glory and made to fellowship with, had degenerated to the point that everything inside them was evil. The imagination of the thoughts of their hearts was evil continually. The unregenerate human heart is deceitful and desperately wicked (Jer. 17:9). Those who believe that mankind is basically good at their core are at odds with what God's Word teaches (see my notes at Rom. 3:10 and 2 Tim. 3:13).
The New Testament Greek word that was translated "imagination" in Luke 1:51 is "DIANOIA," and it means "deep thought" (Strong's Concordance). That same word was translated "understanding" in Eph. 4:18. The Hebrew word that was translated "imagination" here in Gen. 6:5 is "YETSER," and it means "conception (i.e. purpose)" (Strong's Concordance). The imagination of man is literally the womb of man, where all actions are conceived. There can be no real transformation of actions without it first starting in the imagination. The corruption of man had penetrated all the way to the fountain; therefore, all the water that proceeded from that source was bad.