About 4000 years ago there was a country called Canaan that was full of evil people who practiced perverted sexuality and even killed their children as a sacrifice to the gods. Finally their evil got so bad that the god Yahweh decided to destroy their entire civilization off the face of the earth. So he looked around for an army to destroy them and he found a large people group in Egypt who had been slaves to the Egyptians for hundreds of years. He thought he would do two great goods: administer justice on the evil people and at the same time free these poor, innocent slaves from their oppression. So Yahweh appeared to the slaves and cursed their Egyptian captors with plagues until their leaders let the slaves leave. He then led the slaves to Canaan and told them he would give them their land if they would utterly destroy everything living in the land: men, women, children, and animals. And so the slaves conquered the land with the help of Yahweh and dwelled freely. However, they didn’t destroy all people from the land as Yahweh commanded, but kept some alive. Thus for centuries in the midst of their freedom there was constant warring with the remnant of the original people still left in Canaan. Over time, the evil customs of the remaining Canaanite people gradually influenced the slaves until one day the slaves became just as evil as the evil people they had been told to destroy, and so Yahweh found another army to come into the land of Canaan and conquer the slaves just as he had first told the slaves to conquer the evil people of Canaan, and the slaves were taken from their free land and brought into another country to become slaves again.
That is the story of the Old Testament.