At this point you might be asking, ​“Why would a good and all-knowing God create humans with a capacity to rebel that would lead to so much chaos and suffering?”  This is a deep mystery and no attempt to answer this question is entirely satisfying, but we will share a few ideas here that may help. First, the Bible tells us that God wants to be in meaningful relationship with humanity — to love us and to be loved by us. This is not possible if we do not have the capacity to choose love or its opposite, so God created us with the capacity to choose so we can experience relationship with Him. To be clear, we must remember that God does not NEED our love; He is not lonely or needy in any way. Nevertheless, He desires a relationship with us and our free will makes that possible.
Second, God’s goodness cannot be truly known and appreciated unless its opposite, evil and chaos, are also real and known.  In ways that are difficult to understand, the presence and reality of evil allow us to see and appreciate God’s goodness. This is not to say that God created evil and is its source; rather, He created beings (both spiritual beings and human beings) with the capacity to choose evil and, when some chose to rebel, evil and its consequences became real as a result of their choices and actions.
Now the presence of evil in the universe and God’s desire to be in relationship with us when we are a part of that evil creates a difficulty. God can ignore our sin and its consequences and remain in relationship with us as we are, but this is in direct conflict with His goodness and His desire for our ultimate good. On the other hand, He can eliminate evil by an act of force, but in doing so, He must necessarily destroy us in the process since we are a part of that evil. This is where the story really gets interesting!!