I'm going to rephrase your question to "Why do flies exist?" Because at its core this is a scientific question that can be answered (I have no idea how to answer the religious question).
The short answer is that flies exist because they can. Everywhere in nature where there is a niche to be filled (a way of making a living that is not already being used by another species), there is an opportunity for a creature to start exploiting that niche and those that can do it better than others have more decedents than those that cannot and the genes that allow for this exploitation to occur increase in frequency in the population. Over time random mutations occur and some of these offer their possessors an advantage as well and then they too have more offspring because of that advantage and the genes for the advantage increase in frequency through time. In this way, flies became specialized (adapted) for their various niches.
In short, flies evolved to fill many niches and they have been very successful at it. As long as there is a way to make a living some organism will eventually adapt to fill it regardless of its effect on humans.
Why are there deadly viruses and bacteria? For the same reason.