During the days of Noah, the entire earth had become so wicked, primarily through violence, that God decided to
destroy the earth with a flood.
The flood killed everything bird and land dwelling animal, but in particular the flood destroyed the entire human race, except for those on the ark with Noah and his family.
“And all flesh died that moved on the earth: birds and cattle and beasts and every creeping thing that creeps on the earth, and every man. All in whose nostrils was the breath of the spirit of life, all that was on the dry land, died. So He destroyed all living things which were on the face of the ground: both man and cattle, creeping thing and bird of the air. They were destroyed from the earth. Only Noah and those who were with him in the ark remained alive” (Genesis 7.21–23).
Not until we get to the New Testament, do we discover that the Flood of Noah was a type of baptism into Christ,
“For Christ also suffered once for sins, the just for the unjust, that He might bring us to God, being put to death in the flesh but made alive by the Spirit, by whom also He went and preached to the spirits in prison, who formerly were disobedient, when once the Divine longsuffering waited in the days of Noah, while the ark was being prepared, in which a few, that is, eight souls, were saved through water. There is also an antitype which now saves us—baptism (not the removal of the filth of the flesh, but the answer of a good conscience toward God), through the resurrection of Jesus Christ, who has gone into heaven and is at the right hand of God, angels and authorities and powers having been made subject to Him” (1 Peter 3.18–22).
Even as the Flood washed away the filth of the world, saving Noah and his family, so baptism, Peter says by the Spirit, saves us, washing away our sins.