A question that has existed through the ages. When we look into the question for ourselves we can find many and varied answers. Is it karma, reincarnation, lessons, a fluke of nature, or God in a myriad of forms? There is no definitive answer.
I believe the answer to the why question is whatever we choose for ourselves to believe. End of story. Hold on you say; what if you are wrong. What then? Then I will be wrong and no different to how I have had to live my life. That is, not knowing the future perfectly and living with my mistakes and learning from them.
Someone might say it will be too late to learn after you are dead and we could answer how do you know that. That is what you have chosen to believe. We could choose to believe that death is a door and we will find out for sure when we go through it and no sooner. That is why it is called faith and yes even an atheist has faith.
Instead I think the question we need to be answering is how do we want to live our life. Do we want it full of fear, anger, love, compassion, or living only for ourselves. This is a far more important question as we have control over how we live no matter what our circumstances.
This is our choice. This is right now.