Scripture says "always be prepared" to explain our faith, so let's consider this question:
"Why did God create Adam and Eve with the ability to sin?"
God could have programmed mankind like robots, but that would also have made us incapable of love.
Genuine love, like sin, involves free choice.
Imagine how meaningless it would be if your spouse and friends were programmed to love you.
We don't want forced love and neither does the God in Whose image we're made.
That's why God created Adam and Eve capable of right and wrong choices, including love, sin, and redemption.
Of course, this only partially answers our questions because God's ways are beyond our full understanding (Isaiah 55:9).
But we can take joy in this promise: "For now we see only a reflection as in a mirror; then we shall see face to face. Now I know in part; then I shall know fully, even as I am fully known." 1 Corinthians 13:12