People have debated the cause and purpose of suffering for centuries. Job is the person most associated with this struggle to discover why.
The book of Job is about 4 miserable friends who visit Job to be of some comfort to him. Instead they only add to his pain. “Stop assuming my guilt,” he told them. “….for I have done no wrong,” Job 6:29.
The question of suffering is never solved. No one has ever been able to say categorically that this or that is the reason suffering occurs. The best answers are simply a well-educated guess based on the character of God and the evil of our world. That said, I believe that suffering arises from the choices that human beings make in the exercise of their free will.