Is it Allah (SWT) Who creates evil too?
According to Islam, It is Allah (SWT) Who creates good, goodness, beauty; and again Who creates evil, bad and ugly as well.
Some ask, “How is it that Allah creates evil?” It seems that those people cannot imagine the act of creation of evil by Allah (SWT) befits Him. Yet contrary to the common belief, this is a sign of His sublimity.
If a painter is able to draw the picture of the ugly objects, as quite successfully as those of the beautiful ones in which he had already proven good, this means that he is perfect at his art. If he were not able to draw the pictures of the ugly objects successfully, that would be a deficiency. This example could be taken with regard to the creation of evil.
Furthermore, what is evil is not to create it but to commit it.
Let us ask those who say, “Allah does not create evil”: If it is not Allah, then what is it?
In any answer to give to this question, it is probable to apply to polytheism. Creation is peculiar to Allah (SWT) and He has no match, helper, or partner. This is the one side of the point.
We also have the other side of the point, which is “the testing.” If Allah had created only goodness, evil would never exist. Then there would be no point in testing people. To do the prohibited, to commit sins and denial would never be possible. Everybody would inevitably be like angels. Yet this is not what our Lord wishes. He wishes that human beings could do whatever they want with their free will. Therefore, He creates what human beings’ will prefer.
For example, one can go to both mosque and a pub. The first is good and the second is evil. Allah (SWT) creates what humans please. If the feet that take one to the pub become stone suddenly, if the eyes that look at the prohibited things were blind, if those without worship caught some fatal illness, man would have no will power.
Then it is very wisdom to create evil beside good in order to set apart the good and the bad from each other. I think this explanation is the answer to the question “Why does Allah not prevent evil?”