"Then the LORD God saw that the wickedness of man was great in the earth, and that every intent of the thoughts of his heart was only evil continually. And the LORD was sorry that He had made man on the earth, and He was grieved in His heart. So the LORD said, 'I will destroy man whom I have created from the face of the earth, both man and beast, creeping thing and birds of the air, for I am sorry that I have made them.' But Noah found grace in the eyes of the LORD" (Gen. 6:5-8).
What a sad description of just how far mankind had fallen! God, due to His omniscience, is aware of every thought, word, and deed. He knew full well how evil man had become and what mortals now focused on (i.e., "only evil continually"). To say that God "saw" and was "sorry" is accommodative language (i.e., anthropomorphisms). Clearly, God is grieved at mankind's choices, but the language must not be interpreted in any way that suggests His knowledge was imperfect at some point. That which was made in His image was not anywhere close to the standard that deity expected, and that was very troubling to Him. Thus, God decided to start over--in a manner of speaking. He would destroy all living creatures on Earth--except for Noah. Noah was different, in a good way. In the midst of God's powerful judgment and wrath against mankind would be a portion of mercy and grace. Noah, though certainly not sinless (cf. Rom. 3:23; Gen. 9:20,21), was a man of righteousness, character, and faith. God would bless Noah in a way he didn't deserve; God would give him grace to be saved from the planned catastrophe (though even with God's grace, there would be things for Noah to believe and do in order to be spared). God would save Noah's family, too, though no explicit reason is stated. It could be the case (as we might expect) that Noah's wife, his sons, and their wives were also godly like the great patriarch. Or, it may be that they were spared because of their relationship to Noah, merely in order to propagate the human race (something Noah could not do alone). Animals (created for man's dominion and enjoyment) would also share in the destruction of mankind (again, with a few exceptions to start over with).
"This is the genealogy of Noah. Noah was a just man, perfect in his generations. Noah walked with God. And Noah begot three sons: Shem, Ham, and Japheth. The earth also was corrupt before God, and the earth was filled with violence. So God looked upon the earth, and indeed it was corrupt; for all flesh had corrupted their way on the earth" (Gen. 6:9-12).
Humanity had become so corrupt that God simply could not refrain from judgment any longer. Noah, like Enoch, walked with God, but God desired that Noah remain on Earth. A faithfully obedient man is precisely what God wanted to "reset" the human race on planet Earth. Noah was just the man for the job! As a side note, I find it interesting that Noah had no children until 500 years of age (cf. 5:32), and Noah likely started working on the ark sometime after his 480th birthday (cf. 6:3; 7:11). So, he probably labored on the project alone in the beginning and then was blessed with sons to assist him for the bulk of the task. These sons (Shem, Ham, & Japheth) likely spent their first century of life building with their father. Spending that amount of time with Noah (and that much less time with the world) no doubt helped them to be more like the one who found grace in God's eyes and less like those who only thought of evil continually.