Quran copied the Bible which copied from the Old Testament which was made by the Jews. And with each version it was changed to suit the whoever. The Jews also believe that God knew that Adam was going to take the fruit and this is all part of his master plan.
I personally believe the whole story is BS. Logically you can't punish someone who does not know what is bad and what is good. It would be like beating a 2 year old for breaking a glass. It's cruel.
Second if God knew all this was going to happen, it was completely pointless. If man was meant to have free-will God would have just given it to them and just sent them to earth. No need for this whole snake forbidden fruit BS.
Also I don't believe God created the Garden of Eden, because if Adam and Eve were NOT meant to eat the fruit, God would have made it so, instead of putting it in plain site then punishing them.
ALSO! God was a liar when the snake told the truth. Since when does Satan tells the truth? How is the snake made out to be the enemy in all this? If 1. It was meant to happen. AND 2. The snake did not lie to Eve, he tempted her yes, but for their benefit to not be sheep to God.
The whole story of Genesis is not logical at all. And then when you say this, the obvious response, i well it was all meant to happen and God knows best.