Adams sin was purposed by God otherwise Adam would not have known sin. Similar to what Paul testifies to here Rom 7:7-8
7 What shall we say then? Is the law sin? God forbid. Nay, I had not known sin, but by the law: for I had not known lust, except the law had said, Thou shalt not covet.
8 But sin, taking occasion by the commandment, wrought in me all manner of concupiscence. For without the law sin was dead.
Now Adam before his sin was innocent, however he was sinful by nature, meaning even in innocent flesh, he wasnt able to keep Gods Holy Law and all of its purity. Rom 7:12
12 Wherefore the law is holy, and the commandment holy, and just, and good.
When God gave Adam His Law Gen 2:17-18
6 And the Lord God commanded the man, saying, Of every tree of the garden thou mayest freely eat:
17 But of the tree of the knowledge of good and evil, thou shalt not eat of it: for in the day that thou eatest thereof thou shalt surely die.
It was in view to expose, make evident Adams sinnership, weakness of the flesh to keep Gods Law Rom 8:3-4
3 For what the law could not do, in that it was weak through the flesh, God sending his own Son in the likeness of sinful flesh, and for sin, condemned sin in the flesh:
4 That the righteousness of the law might be fulfilled in us, who walk not after the flesh, but after the Spirit.
Hence by this Adam was made ripe to have revealed to him the Saviour of Gods People, Seed of Women Gen 3 who had been ordained before the world began 1 Pet 1:20
20 Who verily was foreordained before the foundation of the world, but was manifest in these last times for you,