This is called the
problem of theodicy. The assumptions usually made in the problem statement are, with a little variance:
- God is almighty and all-knowing
- God does not want evil in the world
- God is good
The problem goes on to state the fact that
there is evil in the world, and claims a contradiction between the assumptions and this observation.
I see really no problem here. If just (1) was true, God could certainly do anything. If (1) and (2) were true, there certainly would be no evil in the world. But if (3) were true, God
would do only things that are good, regardless of whether He
could.
Now we have (1), (2) and (3). God
could do anything, but since He is good he
will not do just anything. There's no contradiction. God could remove all evil, but that would not be good.
Up to that point it's all just logic. The reason that removing evil would not be good is more a matter of speculation. I suspect it has to do with free will: people are allowed to choose between good and evil, and removing the choice would be worse than the evil that ensues. This is just my speculation. God surely has His reasons.
Goodness doesn't always mean doing what is
the most convenient to me. Quoting C.S. Lewis in A Grief Observed,
What do people mean when they say, "I am not afraid of God because I know He is good"? Have they never even been to a dentist?