Why is god good if the killed the whole earth's Population by a flood

It doesn't make sense , plus they teach kids this story? What is this lesson, is it if someone doesnt agree with you murder them?

Edit. There was incest!? Wtf is wrong with god