God's creations, both angelic and human, were not made robotic, but were given brains to think and reason with and make their own decisions. One of God's angels, Lucifer, fell from heaven due to his prideful ambitions, and chose to influence the serpent in an attempt to undermine God's plan. "For thou hast said in thine heart, I will ascend into heaven, I will exalt my throne above the stars of God…..I will be like the most High…..for out of the serpent's root shall come forth a cockatrice, and his fruit shall be a fiery serpent." Isaiah 14:12-15, 29
God would have been very happy to see Adam, Eve and their posterity live eternally in the beautiful Garden of Eden, but that had to be their decision. His command in Genesis 2:16, 17 gave Adam a choice and very explicitly stated the penalty for disobedience: "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, dying, thou shalt die." (KJV margin) However, the serpent lied and told Eve, "Thou shalt not surely die." Genesis 3:4
If God used the serpent to tempt Eve, why would he lie? "It is impossible for God to lie." (Hebrews 6:18 NIV) "Let no one say when he is tempted, I am tempted of God; for God is incapable of being tempted by evil and He Himself tempts no one." (James 1:13 Amplified) We know that, "The serpent completely deceived Eve in his craftiness." ( II Corinthians 11:3 Rotherham)
"Adam was not deceived." (I Timothy 2:14 NIV)
Isaiah 14:15 outlines the destruction of Lucifer (Satan), while I Corinthians 15:21, 22 explains the plan for the resurrection and restitution of mankind: "For since by man came death, by man came also the resurrection of the dead. For as in Adam all die, even so in Christ shall all be made alive." So, even though Adam and Eve ate the fruit of the tree of knowledge, God had already planned the way of salvation for them and for all of their children. (Revelation 13:8)