The deluge of water by which all air breathing creatures, except Noah and his family (total of eight humans) and the different animals and birds housed in the ark, were destroyed because of mankind’s sinfulness (Gen 6:13). After God closed the door of the ark, it rained for 40 days. The inhabitants of the ark disembarked after a total of 371 days. God declared He would never again destroy the world with a flood and gave the rainbow as His signature (Gen 9:11,13-17).
The timing of the flood is undated but appears to have happened relatively early in the world’s history.