Adam and Eve didn’t have all they needed in Eden, they lacked one thing, something God asked them to opt for: Himself. They had not yet freely bound themselves to the ultimate good, their Creator, which would’ve ensured them perfect happiness and fulfillment. So even they were depraved in some ways, while possessing enough knowledge from God to be able to make the better choice then the one they did, which meant disassociating themselves from God, seeking their happiness elsewhere, in themselves and other created things as it turned out. Man needed to learn his limitations vis a vis God. Man needed to come to know of his need for God, of his lost condition without God, of the overwhelming superiority and trustworthiness and goodness of God. And so God took away even that which man had, leaving man to his own devices to experience a world where God and His wisdom and will and His love did not reign supreme; Adam & Eve got what they wanted. They would from then on literally know both good and evil, the evil of separation from God with all the sin, corruption, and death that that separation entails, the evil that we continue to experience or know to this day.
The purpose, the reason, is that God created His world “in statu viae” in a “state of journeying” to perfection, even if that meant a detour into a land where we might possibly learn to hate and avoid all that is evil, all that is inconsistent with Him., so that, when He calls, we should have gained the wisdom to answer Him, to turn back to the true and ultimate Good, the source of all good.