Bible
Why did God flood the whole world?
Genesis describes a world so filled with violence and wrongdoing that "every inclination of the human mind was nothing but evil all the time" (Genesis 6:5). The flood is presented as God's response to that—serious judgment on serious, widespread wrong, not a random disaster.
It's a hard story, and the Bible doesn't try to soften that. God is described as grieved, even regretful, over how far humanity had fallen (Genesis 6:6)—this isn't told as an easy or emotionless decision.
But judgment isn't the only note in the story. God specifically saves Noah's family and provides a way for every kind of animal to survive, and afterward makes a covenant promising never to destroy the world this way again, marked by a rainbow (Genesis 9:11–13). Destruction and mercy sit side by side in this account.
Later biblical writers treat the flood as a pattern for how God deals with evil generally: seriously, but never without also making a way of rescue for those who turn to him.
Bible quotations in these answers are generally taken from the Christian Standard Bible®, Copyright © 2017 by Holman Bible Publishers. Used by permission. Christian Standard Bible® and CSB® are federally registered trademarks of Holman Bible Publishers. Some biblical wording may be paraphrased or follow other translations.