Evil exists for a very simple reason: God gave us the gift of freewill so we could freely choose to love God or to reject Him. If we didn’t have freewill, then we’d be robots who always obey God. Love can only exist if it is freely chosen. We show our love for God by keeping His commandments: “If ye love me, keep my commandments” (John 14:15). If we do not wish to love God, we are able to be unloving towards God by choosing to break His commandments, made possible due to freewill. All of the evil in the world is the result of man being disobedient to God, choosing to break His commandments, made possible through freewill.
From the beginning, it was God’s desire to create a family who He could love and who could love Him back, having a relationship with this family. In order for love to truly exist, it must be freely chosen, otherwise, it isn’t truly love. God gave us the freewill that allows us to freely love Him and to love His creation. By necessity, this freewill also gave us the freedom to be unloving towards God, giving us the freedom to break His commandments if we so choose.