You are right: The devil's primary goal is to oppose God in every way he possibly can, and to try to turn us away from God and get us to follow his ways. The Bible calls him our "adversary (or enemy)" (1 Peter 5:8, NKJV); Jesus labeled him "a murderer" and "the father of lies" (John 8:44).
Satan hasn't always existed; only God is eternal. At one time, the Bible indicates, Satan was one of God's most powerful angels, created by God to do His will. But pride took hold of him, and he decided to revolt against God and put himself in charge of the whole universe: "You said in your heart, 'I will ascend to heaven; I will raise my throne above the stars of God. ... I will make myself like the Most High'" (Isaiah 14:13-14).
Satan's revolt failed and he was cast out of heaven -- but he still is at work, and we must never underestimate his power or his ability to deceive us. The Bible says he is the one "who leads the whole world astray" (Revelation 12:9). Sometimes his evil works are obvious -- but sometimes he disguises himself and tries to make us believe that he stands for what is good.
Yes, the devil is our foe -- but listen: He is a defeated foe! By His death and resurrection Jesus Christ conquered death and Hell and Satan -- and someday that victory will be complete when Christ comes again. Are you ready for that day? You can be, by opening your heart to Christ and giving your life to Him today.