The first two chapters of Genesis provide two very different accounts of Creation.
Firstly, they are contradictory. The sequence of Genesis 1:1 – 2:4a is plants, animals, then man and woman, whereas the sequence of Genesis 2:4b – 25 is man, plants, animals, then woman. S econdly, in the account at Genesis 1 the name of God is “Elohim” (35 times), whereas in the second account the word “God” never appears, but rather “Yahweh” is used (11 times).
The Yahweh Creation story (Genesis 2) was written first, probably by a scribe (male or female) of the royal court of Judah. It was written before the destruction of Israel, likely following the start of the reign of Jehoram. Throughout the first four books of Scripture, when narrating, this writer only uses “Yahweh”, never “Elohim” (God).
The Elohim Creation story (Genesis 1) was written after the destruction of Israel, likely by a priest during the time of King Hezekiah. This priest did not use “Yahweh” in his writings until that name is revealed to Moses at the burning bush. This priest was aware of the existing Yahweh Creation Story when he wrote his very different account.
Each Story has its own, different objective. The structure of the Elohim account (Genesis 1) with its parallel days (1 and 4, 2 and 5, 3 and 6) culminates in the Sabbath. This is clearly the focus of the message taught by that priest. The structure of the Yahweh account (Genesis 2) shows that its focus is marriage. The stories were vehicles employed by each writer to influence behaviour in their own community.
Some time following the end of the Babylonian Captivity, a priest, likely Ezra, combined these accounts. As he did this, he inserted a lot of his own material as well as incorporating Deuteronomy, which was probably the work of Jeremiah and/or his scribe Baruch.
(Major reference: “Who Wrote the Bible?” by Richard Elliott Friedman. – I highly recommend it; it reads like a well-written detective story.)
Doug