You ask a great question–and a very tough one. The origin of evil puzzles us because of our understanding that God originated all things and if so, did He originate evil? I will quote from Norm Geisler and Ron Brooks:
1. God made everything perfect.
2. One of the perfect things God made was free creatures.
3. Free will is the cause of evil.
4. So, imperfection (evil) can arise from perfection (not directly, but indirectly through freedom).
They go on to say, “One of the things that makes men (and angels) morally perfect is freedom. We have a real choice about what we do. God made us that way so that we could be like HIm and could love freely (forced love is not love at all, is it?). But in making us that way, He also allowed for the possibility of evil. To be free we had to have not only the opportunity to choose good, but also the ability to choose evil. That was the risk God knowingly took. That doesn’t make Him responsible for evil. He created the fact of freedom; we perform the acts of freedom. He made evil possible, we make evil actual. Imperfection came through the abuse of our moral perfection as free creatures.
As for the snake, the same answer applies. God made Satan the most beautiful of all creatures with the perfection of free will. Satan rebelled against God, and that became the first sin and the pattern for all sin that followed. Some people ask, “What made Satan sin?” That is like asking what caused the first cause; nothing outside his own free will caused him to sin. He was the first cause of his sin and you can’t go back any father than that. When we sin, ultimately we (by our wills) are the cause of the evil we do. (When Skeptics Ask, p. 62-63)