There are a couple reasons for this, neither is exclusive of the other.
1) The two creation accounts tell us different information. The first account is a larger over-arching account that covers all of creation, while the second account focuses more on the creation of humans, and specifically the man and the woman.
2) The other reason is that these two accounts may have come from dual sources. Authorship for Genesis is attributed most often to Moses, but obviously the contents of Genesis happened before he was alive. Moses likely collected these accounts that had been handed down from his ancestors, some written perhaps some oral. And it is possible that these two accounts originated from two different sources. In other words, authors who had been inspired long before Moses, wrote or told different versions of the creation accounts. Then, generations later, Moses played the roll of God’s editor, and he put in Genesis the accounts of creation that were true to communicating the truth.
Neither account contradicts the other. They just give us deeper insight into who God is and who we are.