Why did HaShem create Shabbos? He doesn't need rest!
The application of the verb 'resting' to God is one specific instance of the general problem of language that attributes actions or attributes to God. This general problem is the main topic of Part I of the Guide of the Perplexed. For the specific chapter of the Guide dealing with the verb 'to rest', see Part I, chapter 67.
In the chapter, the Rambam deals separately with the three pertinent verbs: va-yishbot, va-yannach, and va-yinnafash. For each, he suggests readings in which the meaning is not 'resting' in the sense of recovering from being tired.
'Va-yishbot' might mean ceasing from some activity, so, ceasing from the activity of creation. For 'va-yannach', the Rambam quotes Bereishit Rabbah parsha 10, which says it means 'caused to rest', i.e., He caused His world to have rest. He also suggests the possibility of it meaning that He caused the world to begin to exist in a stable way, as opposed the supernatural processes which had occurred during creation. For 'va-yinnafash', he sees it as meaning, 'He had His will fulfilled.'
Does G-d rest? Isn't G-d all-powerful? Actually, the word “rest,” “say,” “did” and other actions of anthropomorphic verbs should be taken figuratively. When the Bible states that G-d “rested” on Shabbat (the seventh day,) it is to be understood that creation had ceased as if G-d rested (Maimonides, Guide of the Perplexed 1:67).
The Shabbat was chosen to be placed on the seventh day because seven is significant in Judaism. The lesson also teaches that there is a G-d, and among other things, that Shabbat helps psychologically to ease the mind after the workweek.