Have you ever noticed that in the creation story in Genesis 1 the last thing created was humanity, while in Genesis 2 the human was nearly the first creation created even before plants and animals? Why don't they agree?
Most people reading the Bible don't even notice the differences. The answer of why isn't immediately obvious, at least not in English, unless you carefully compare the texts.
First, let's do a comparison of what is called the first creation account (Genesis 1.1 2.4a) and the second (Genesis 2.4b-23). The first account is certainly better known, though most readers tend to blur the stories. In Genesis 1 the first thing created is (1) the heavens, the earth, and light. This is followed by (2) a separation of the earth from the sky (actually a separation of the waters of chaos that were thought to surround the sky and the disk-like earth). Then (3) dry land and vegetation, (4) sun, moon, and stars, (5) birds and fish, and (6) land animals and the humans (both male and female).
The second account is quite different (see figure 1). Genesis 2 doesn't use time specifications, there is no "On the first day God created. . . ." Instead, the account begins with a statement that the earth and heavens were created. Verse 5 tells us no plants yet grew on the earth because there had been no rain and there were no humans to till the ground. Next God creates a human. This first created being was literally an androgynous human without gender, having neither maleness nor femaleness in the Hebrew. Then God plants a garden for the human to tend. God then decides this lone human needs a helper, a companion, and creates all the animals for the human to inspect, name, and decide if a helper has been created. When no suitable companion is found, God literally "splits the adam" and the results are a male and a female, both specifically gendered in Hebrew.
Okay, a side-by-side comparison of the two accounts shows significant differences. Why?
For those doing this study from most translations, including King James, Revised Standard, and the New International to name only a few, the answer is suggested by a comparison of the names of God between chapters 1 and 2. If you look at the name in the first chapter you'll see only the word "God used never Lord, Lord God, or anything else. But in 2.4b through chapter 5 the term LORD God is used (note the capital letters in most translations indicating the Hebrew Yahweh, the personal name of God). The difference between the names for God in the two chapters is the clue as to "why."
Early tradition taught that Moses wrote the first five books of the Bible even though the books nowhere indicate Moses as the author. However, in the 18th century a French physician named Astruc noted the differences in the divine names of God in Genesis. From his findings it was postulated there must have been two authors to Genesis.
Since then scholars generally agree that the first five books of the Bible weren't written by Moses, but by at least four different writers. These different gooks or accounts were gathered around the fourth century BCE and then combined and edited by a fifth writer or group of writers. The results of the editors' work is what we have come to know as the Pentateuch, literally the five books, the first of which is the book of Genesis.
That is why there are two different accounts there were two different authors sharing different traditions. The first account tells of a God who is orderly and powerful. The second account is more concerned with sharing a personal and responsive God to the humans and to creation. Both accounts speak of the same God. Both share important aspects about God. And both accounts are valid and helpful in our understanding of creation's relationship with the Creator.