The world God had created originally was to be pure and free of sin and it had now become a sinful world and his people were no longer his good people they once were...
God decided that the world needed to be cleansed of its sins and bad ways, to clear the earth of the bad people and their sins. He would do so with a world wide flood.
Genesis 6:7 "I will wipe out from the earth the men whom I have created......but also the beasts and the creeping things and the birds of the air, for I am sorry I made them" -the Lord
After many years of building the ark he finished. He warned the people but they didn't Believe him. So when the flood came, the non believers perished in the flood.
So once the flood was ended, and the waves calmed and the winds slowed , a dove came upon the ship with a olive branch in his beck, a symbol of peace and land nearby , a safe haven for the ark and it's passengers.