It is an ancient tale told and retold in many mythologies for thousands of years. Mankind multiplies and spreads, mankind pisses off supernatural diety, supernatural diety saves a small portion of mankind while the rest get genocided by the primordial waters of creation and the world is made anew.
The biblical version of this story is the one we will be reading today, starting with Genesis 6 and 7. As always, please do read along. It is much more fun that way.
The story of Noah and the genocidal flood is another example of the popular culture versions of these stories differing from the story as told in the book itself. One example of this is the account of Noah being mocked by unbelievers over the course of the 100 years that it takes him to construct the ark. The Genesis account makes no mention of this or of any other human contact by Noah with anyone other than his family. However, we do know that this addition to the story is not a recent one due to the fact that it is found also in the Quran, making that addition to the story several hundreds of years old.
The biblical version of this story is the one we will be reading today, starting at Genesis 6. Mankind has existed for a long time now and according to the third verse they have grown far from god and their lives are limited to no longer than 120 years as a result. Therefore our story begins, with 500 year old Noah as the main character.
God notices that his creation is becoming corrupted and evil, not at all the way he hoped they would (I am not sure whether the authors of the Genesis account simply didn't realize how dumb that sounds given the idea of god as all-powerful and all-knowing, or whether they believed like the polytheists they stole the story from that their god was unimaginably super-powerful but not all-powerful) and decides that the best way to handle the situation is genocide. Noah is visited by god and given specific instructions on the construction of an ark to save his family and repopulate the world with after the genocide is complete.
Noah is then given specific instructions to bring two pairs of each unclean and seven pairs of each clean animal onto the ark. The characteristics that differentiate clean from unclean animals are not given until later in the bible, but presumably Noah would have known what these characteristics are. One hundred years later Noah finishes building the ark and the flood begins. Note that while the time between Noah entering the ark and Noah leaving the ark was about one year, the phrase "forty days and forty nights" is used to describe how long the rain that contributed to the flood lasted. Because this phrase is used so often in the Bible it is useful to note that at the time these stories were put to paper this phrase was used to mean "a log time" in a similar way to how people in the modern day might say something like "a minute' to refer not necessarily to an actual minute but instead to mean "a short time"
The flood that begins is able to cover the entire planet, because as mentioned before ancient people didn't understand a lot about cosmology and thought that the sky was blue because there was actual water held in the sky that could come down onto the Earth. So, with the ark complete and the genocide begun Noah and his family take what they can onto the ark and start their year-long wait for the flood waters to subside.