Becasue the story, in Genesis 1, is a retelling of an older Babylonian creation myth involving seven gods who decided to create the world (were they bored, the story does not say).
The first one did very general stuff,
the second one added to it...
By the time the 7th god got his turn, he found nothing to add, so he "rested" (did nothing).
The story was known in Egypt and Moses probably learned it while being raised with Pharaoh. He adapted the story to a monotheist religion (using only one god, and using 7 days) and added it in front of Genesis.
What we now call Genesis 2 is the original Hebrew creation myth -- in the older documents you can see the language used in 2 is older than the language used in 1. It is like comparing the original language used by Shakespeare himself, with later versions.
Moses was stuck with the problem that the Hebrew people had given up on observing the Sabbath, and he wanted them to see the importance of "resting", along with Yahweh, once a week.
THAT is why God needed to rest on the 7th day. Not because He was tired by work... he was just tired of us ignoring Him.
I remember when we used to close everything on Sundays. Now Sunday has become the biggest shopping day of the week. No wonder He sent his Great Pumpkin to punish us.