The “beginning” of Genesis 1:1 is often separated from the six days that follow, as though the heavens and the earth were created before the six days began. Actually, the “beginning” in Genesis 1:1 is speaking of the entire six “days” of creation. This can be seen by comparing the “beginning” of the heavens and the earth, with Exodus 20:11, where we read: “In six days Yahweh made heaven and earth, the sea, and all that is in them, and rested the seventh day.” (See also Exodus 31:17) Thus, Genesis 1:1, which speaks of the “beginning of the heaven and the earth”, is an introduction giving a brief description of the six days that are described in the following verses.
For more information regarding this, see: