People exist cause God created the humankind
1 5 1
A simple logical analogy: if good exists then how can it prove it's existence if there is only good, so thus evil is necessary to explain and justify one another. So it stands that if there are good people, there should also be bad people in order for them to learn the difference between the two. 

But the relation between good, evil and God is more complex:
From a philosophical point of view this is a pretty common problem called TheProblem of evil (which offers a few explanation for this like the The Virtue Defense -evil exists so that centain virtues can exist- or The Free Will Defense -evil is permitted as to allow the existence of free will)From a chinese metaphysical point of view there is the concept of Yin and yangwhich:describes how apparently opposite or contrary forces are actually complementary, interconnected, and interdependent in the natural world, and how they give rise to each other as they interrelate to one another.From a christian point of view, God created a perfect world, in which man had no knowledge of evil, but man was tricked and brought evil into his life. Again from a Christian point of view, every man is good and can be saved (from evil) if he chooses so (man is only tempted by evil, but he always has the capacity to be good).From a spiritual point of view, experiencing this duality of both good and evil helps us better understand the concept of good and bad and grow into more evolved spiritual beings.