This question has given rise to a number of competing answers among religions.
Hinduism: Karma for past sins.
Zoroastrianism: The Prince of Darkness.
Gnosticism: The demiurge.
Dharmic Philosophy: Maya, the illusion that one is finite.
Greek Myth: Pandora’s box.
Now science has its answer. Suffering exists because it helped out ancestors survive. We evolved suffering for the same reason that we evolved color vision, balance, and an immune system.
Why Do Bad Things Happen to Good People?: related rant
No Good Reason: related rant
That's me, as my daughter would have it.