The narrative presented in Genesis 2 is not literally compatible Genesis 1. We are not reading a flashback to the sixth day of the previous chapter. Nor should we accept the extremely strained interpretation that Genesis 1 involves a conceptual creation of things, while Genesis 2 portrays a later physical manifestation of those things.
We have in Genesis 2 a different creation story. Where the previous chapter was fairly straightforward (if a bit philosophical), we have in Genesis 2 something that plainly belongs to the genre of 'myth'. The individual pieces we find in Genesis 2-3 — a first man, a first woman, a garden paradise, a snake, edible immortality — though their specific arrangement in this story is unique, are stock images of ancient Near Eastern mythologies.
The strongest parallels are to be found in the Epic of Gilgamesh, a story far older than the biblical Book of Genesis. In the late chapters of Gilgamesh, the eponymous hero meets Utanapishtim, the original survivor of the ancient flood who has mysteriously stayed young in the ages since. Through Utanapishtim's help, Gilgamesh acquires a plant that, when eaten, will also grant him youth. When Gilgamesh stops to bathe before he eats the plant, a snake comes along and eats it instead. (Hence, we have an etiology for why snake's shed their skin, appearing 'young' again.) With that, Gilgamesh's promise for eternal youth is lost.
In many English translations of Genesis 2-4, 'the man' whom God created eventually receives the proper name 'Adam'. What goes unnoticed by English readers is that no such transition occurs in the Hebrew. He is consistently called 'the man' (ha adam) throughout the whole narrative; he is never named the way Yahweh, Eve, Eden, the four rivers, or the animals are identified or given names. (Only in 4.25 is he called simply Adam instead of ha adam, but this text is sometimes taken as a later redaction, for unrelated reasons I will cover in a later article.) Strictly speaking, 'Adam' was not the first man's name in the original telling of the story, but only when it was conjoined to later traditions that had turned ha adam into the proper name Adam.
The identification of humans as adam (instead of other Hebrew words for 'man') is a play on words, similar to eden and ed: the adam (man) was made from the adamah (ground). This creation of humanity from the earth is not unique to Genesis 2; a similar concept is found all across Indo-European myth. George & George also discuss other possible inspirations for the name, such as a latent anti-Mesopotamian polemic underlying the story. As with the incorporation and remixing of images inspired by the Sumerian Epic of Gilgamesh, the choice of ha adam (as opposed to iysh or enosh) may have been intended as a criticism of Assyria, one of whose kings was named Adamu.
Inspiration for Adam is sometimes seen in the character of Enkidu, the secondary protagonist from the Epic of Gilgamesh. Enkidu is created by the gods, wild and naked, with only animals for his companions. He is tamed when a temple prostitute is sent to sleep with him, and she teaches him to eat the food of civilized humanity. The comparisons of Enkidu with Adam, the prostitute with Eve (or even the snake), or the food of civilized humanity with the Tree of Knowledge of Good and Evil, I find to be forced at best.
Genesis 2 portrays a different creation account, differing in order and theme from Genesis 1. The first man was not, originally, named 'Adam'; that was only the Hebrew word meaning 'man'. The story may partially have been written with anti-Assyrian undertones, with 'Adam' reflecting criticism of Assyrian kings.