the logic is quit complicated behind it, let's assume someone who is non believer god knows his destiny for sure either heaven or hell but there are things in life that can interfere with his destiny like for examples that heart that knows arrogance when it come to analyzing the truth he only recognize what he knows and he trash everything else so this guy is blind for sure so he is not going to get guidance, his destiny is known, why because even he can see the truth he will not accept it because of his pride, so there are two people one with a open heart and the other with close heart and here is in the QURAN SURAH AL HAJJ 46
"So have they not traveled through the earth and have hearts by which to reason and ears by which to hear? For indeed, it is not eyes that are blinded, but blinded are the hearts which are within the breasts."
"Now, who can be more unjust than the person before whom his Lord's Revelations are recited to admonish him, and he turns away from them and forgets the evil end to which he has paved the way with his own hands? As regards those people, who have adopted such an attitude, We have put coverings over their hearts which do not let them listen to the Qur'an, and We have produced heaviness in their ears. While in this state, they will never be guided aright howsoever you may invite them to the Guidance."
why he created us there is no answer surah Al Anbiya 23
"He is not questioned about what He does, but they will be questioned."
SURAH AL BAQARAH 30
"when your Lord said to the angels, “Indeed, I will make upon the earth a successive authority.” They said, “Will You place upon it one who causes corruption therein and sheds blood, while we declare Your praise and sanctify You?” Allah said, “Indeed, I know that which you do not know."
ALLAH From his generosity he did not want to be alone. We have been given the presence of us who have never existed, and granted us existence, He created us to prepare us for everlasting life. From the goodness of ALLAH that He gave you the grace of existence. He gave you the opportunity to exist, to enjoy life here on earth, to have a chance to live in eternal bliss, if you want, and to do what makes you worthy of bliss, Allah gave us choices either willingly or unwillingly to worship him.
"I created the jinn and humans for nothing else but that they may serve Me"