(Disclaimer - I'm not God)
Very long explanation for this, but in a nutshell...
A third of the angels, lead by Lucifer, rebelled against God. At some point they mated with human women to produce the Nephilim (their giant hybrid offspring) thus polluting the bloodline of the human race:
"The Nephilim were on the earth in those days, and also afterward, when the sons of God went to the daughters of humans and had children by them. They were the heroes of old, men of renown".
God possibly saved Noah and his family because they had not been affected by this.
The Nephilim were evil and "Every inclination of the thoughts of the human heart was only evil all the time".
God sent a flood to cleanse the Earth (his creation) and restore it's goodness. He could have sent an asteroid to wipe it out completely but decided to again offer hope to humanity.
The people of Earth were sacrificing their live babies in fire. Yes they were drowned, but I look at it like they were being saved from a miserable life and the wickedness around them and inevitably also becoming wicked. I believe all babies and children are taken to Heaven, so although it appears cruel, it was most likely merciful.