Because of how evil the people were, noah and his family were not evil so God told him to build an arc and put his family on it and two of every animal, after it rained for 40 days and nights the earth was completely filled with water and once it evoporated God put a rainbow in the sky which is a promise to never flood the earth ever again.