Theodicy
Theodicy is a branch of theology that seeks to explain why a God that is seen as all-loving, all-seeing, and all-powerful allows evil to exist. The word comes from the Greek words for God and Judgment and so means the judgment of God. It was first made up  by the German philosopher Gottfried Leibniz in 1710 in his work Théodicée. The subject has been the focus of argument and thought for hundreds of years before that and since.