In two of his books (listed below), John H. Walton examines Genesis 1.1-2.3 according to its similarities to other 'creation myths' in the ancient near east (ANE from here onward), verbal cues with contemporary or related Hebrew scriptures, and so on. He doesn't go much in the way of authorship or the originally intended audience, although possibilities can be gleaned from what he has to say about the structure, genre, and purpose of the text. I'll summarize below Walton's major points, but I would of course recommend reading his books.
Genesis 1.1-2.3 is based, of course, around its seven days. In days 1-3 God establishes 'realms': day and night, sky and sea, and land (with vegetation). Following this, in days 4-6 God establishes the residents of those realms: the sun, moon, and stars for day and night, the birds and sea creatures for sky and sea, and land animals and humans for the land and vegetation.
It is often suggested the verbal repetitions, in addition to the thematic parallels of the days, would make the text easier to remember for oral tradition.
However, Walton writes, 'Days four through six are literarily parallel to days one through three, as has long been recognized, but the literary structure is secondary' to the intended purpose of the text.
Verses 1.1 and 2.3 are best understood as an inclusio. An inclusio is when a given text begins and ends on the same points by way of verbal repetition. Those two points thus become a summary of everything that is described between them. Genesis 1 begins 'In the beginning, God created the heavens and the earth', and ends with 'Thus the heavens and the earth were finished, and all the host of them'.
Ancient Near Eastern Thought
Keeping the text rooted in the ancient world, Walton is not alone in arguing that the cosmology - the shape of the universe - in Genesis 1 is very similar to other ANE cosmologies, especially that of various Mesopotamian cultures.
The inclusio mentioned above shows that Genesis 1.1 is not actually a part of the creation act, but a summary preface of what is about to happen. As such, verse 1.2 presents the pre-creation existence as 'the deep' and 'the waters'. Portraying the pre-creation existence as a sea of chaos was typical in ANE cosmologies. Sometimes this chaotic sea is personified as a monster: the Babylonian creation myth calls this chaos monster Tiamat, and the world is created out of her remains when the gods kill her. The name 'Tiamat' is etymologically related to the Hebrew word for 'the deep', tehom (תהום), which we find in Genesis 1.2.
So similar to other ANE thought, Genesis 1 depicts pre-creation existence as a chaotic sea. When God begins his act of creation (1.3), it is understood as creating out of tehom, bringing order to the pre-creation chaos.1
Another obvious similarity to ANE cosmologies is the firmament from Genesis 1.6. While some contemporary translations call it the 'expanse', which implies a vast openness more compatible with modern understandings of the sky and space, the word is raqiya (רקיע), which is always in the Hebrew scriptures to describe something that has been hammered and spread out. What is being described is a solid, dome-like structure that covers over the earth and holds back the waters, just like we find in other ANE cosmologies.2
Walton argues that the purpose of the text is twofold.
First, he argues the focus of the text is not necessarily on the physical origin of the universe, but of the origin of 'functions' and 'functionaries'. He begins this by clarifying the meaning of 'formless and void' in Genesis 1.2, from the Hebrew tohu va-bohu (תהו ובהו). By following how these two words are used elsewhere in the Hebrew scriptures, Walton notes they are never specifically used for the physical non-existence of the objects they describe, but rather the non-functional quality of those objects. About half of the occasions tohu is used, it describes the desolate nature of the wilderness or a ruined city.
Because of this, Walton argues Genesis 1 is intended to be understood as God 'creating' by assigning functions to objects (i.e. the events of days 1-3), and filling those functions with functionaries (the events of days 4-6). He shows once more that there are significant parallels to other ANE creation myths. Days 1-3 in Genesis 1 can be summarized as the creation of time functions (day 1), weather functions (day 2), and food functions (3). In the Enuma Elish, the Babylonian creation myth, the gods slay Tiamat, and begin to create worldly functions: night and day (tabler 5, lines 38-40), clouds, wind, rain, and fog (lines 47-52), and 'harnessing the waters of Tiamat for the purpose of providing the basis of agriculture' (lines 53-58). The order in which these things are created is the same as days 1-3 in Genesis 1.
The other purpose of the text can once more be determined by verbal cues and literary parallels to other ANE creation myths.
Walton notes that Enuma Elish – after Tiamat is slain, after the functions of the world are established from her remains, after humanity has been created – concludes with the creation of a temple for the god Marduk: 'Below the firmament, whose grounding I have made firm, A house I shall build, let it be the abode of my pleasure. Within it I shall establish its holy place, I shall appoint my holy chambers, I shall establish my kingship' (5.121-124). Later, 'We will make a shrine, whose name will be a byword, your chamber that shall be our stopping place, we shall find rest therein' (6.51-52).
The climax of the creation of the world was the creation of a temple, which would serve as the place of 'rest' for the supreme god-king Marduk.
Genesis 2.2-3 describes day 7. At this point, 'the heavens and the earth were finished' already, so day 7 is not an act of creating anything. Instead, day 7 gives meaning to what has just been created: God comes to 'rest'. Appealing to other Hebrew texts, Walton states that 'divine rest' in ANE thought always occurs in a temple. One key text that substantiates this claim is Psalm 132, verses 7-8 and 13-14, which describes the temple in Jerusalem as the 'resting place' and 'dwelling' of God. Taking this temple concept back to day 6, we find humanity is created as 'the image of God'.
The necessary conclusion then becomes that the universe that has been created on days 1-6 is the temple that God comes to 'rest' in on day 7, with humanity acting as the temple image.
In other words, the Genesis 1 creation myth is simultaneously a 'temple text', as several other ANE creation myths were. As a 'temple text', Genesis 1 illustrates two things. First, it describes humanity's intended function: the temple icon that reflects God into the rest of the temple. Second, it presents how God should be perceived: the supreme creator god-king.
John H. Walton. Ancient Near Eastern Thought and the Old Testament: Introducing the Conceptual World of the Hebrew Bible.
John H. Walton. The Lost World of Genesis One.
1 Other creation texts in the Hebrew scriptures do have more direct parallels to the concept of the gods slaying a sea-monster that personifies chaos. Psalm 74.14-17, 89.9-11, and Job 26.7-13 are each creation texts, with a special focus on God slaying a sea serpent and holding back the waters.
2 Job 37.18 uses the verb form raqa (רקע) to describe how God 'spread out the sky, like a molten mirror', clearly portraying the boundary of the sky as a completely solid object.