God knew that satan is there because of God’s Omniscience. The Lord is all-knowing and powerful. He could chase satan away but He didn’t. Let’s say that it was a part of God’s plan to test our ancestors.
People are talking metaphorically. There are multiple senses of Scripture. I will explain why this would be so in the literal sense, limited as I am in my interpretation.
Because he wanted to seduce Eve and Adam into sinning, taking the form of an animal makes sense. Who would suspect it? Previously, they lived in harmony with nature.
I’ve always assumed that the text taken literally meant snakes originally had legs but now don’t, though perhaps that is my ignorance.
Satan, being immaterial, can appear anywhere, essentially. He can also manipulate matter to appear as a snake, or perhaps possess a snake or what have you.
I particularly reccomend St Thomas Aquinas’ book interpreting Job. I have only read a little of it, but it does feel eye-opening.
Scott Hahn considered that Satan (serpent) appeared to Adam and Eve as some sort of menacing dinosaur. So when he (Satan) lost his legs as a punishment he would have become a snake crawling about.
Why was Satan in the Garden o Eden? When God placed Adam and Eve in the garden He commanded Adam to ’ keep the garden’ . Keep doesn’t just mean ’ Grow plants and shrubs. It also means to guard. Adam failed to guard the garden, or to guard his wife when she was assailed by the serpent which resulted in them falling into sin.
When God challenged Adam about their sin Adam replied " It was the woman you gave me. When God questioned Eve she answered !it was the serpent that tempted her, and when God questioned the devil he hadn’t got a leg to stand on .