To answer this, we must look first at the definitions and relative positions of good and evil. God, as the Supreme Being, is what is known as the Ultimate or Highest Good and the source of all goodness. Also, as the Supreme Being, He is the Ultimate Cause of everything; everything that is, He brought into existence. Now, since He is good, all that comes from Him is good, including the existence which He gives to all of creation. It is because of this fact that we are able to say that whatever is, is good, at least insofar as it has existence.
If existence is good, and if evil is not good, evil cannot have existence or being in the sense we spoke of it above. Evil is, rather, an absence of good. That is all. When we do something evil, what we are assigning the word "evil" to is not actually an entity but rather a lack of goodness.
With this philosophical basis, we can understand then where the evil of the devil came from. He was created good but with a free will. He could choose good (which is God) or not good (which we call evil). In choosing evil, he merely rejected good.
If you want to take the question into the matter of why God allowed him to choose evil, we can answer this by an explanation of God's love. God, being self-aware, of course knows that He is the fullness of goodness. He knows that only goodness will satisfy and make happy all His creatures. However, He loves them so perfectly that He wants to give them the dignity of knowing both possibilities--Him and not Him, good and not good--and deciding for themselves. This is why He allows free will to His higher creatures, men and angels. They can choose Him (Goodness), or they can reject Him.
Let's first take a lookon God's Sovereignity and Power, when He spoke with His mouth; "Let there be light and there was light" that was recorded in the book of Genesis. It is clearly says that God is Almighty who was created up above in Heaven and the Earth. Actually Lucifer is the specific name of what we called Satan nowadays. God is gracious and usually give chances for everyone, so He gave Satan the authority to lead the angels in Prasing and Worshipping the Lord in the Heavenly Kingdom. But here comes the selfishness within Lucifer or Satan, since he has free will to choose on that very moment, He choose to disobeyed or rebelled against the Lord as he recruited the 1/3 of Angels in the Heaven to protest or make a fight against the Lord-who is the Creator!!!Of course if God is all knowing He will surely discovered Satan's evil thought and because of Pride, the Lord eliminated Satan from the Heaven so that it'll not be an impure place for all, if they still keep the rebellious satan hanging out there. Take note GOD is pure yesterday, today and tomorrow. Satan's evil kindness was not came from the LORD, but to himself only.
The devil, was actually a angel named Lucifer. He was God's favourite angel. He had everything, his robes were full of precious gems like diamonds and rubys.
But Lucifier was jealous of God, he wanted to be more powerful than him. So he collected a group of angels and wanted to fight against God. But since God is more powerful than any angel in heaven, he banshied Lucifier from heaven and sent him down to a place he created for him and his followers, hell.
And is where his evilness come from, jealously.
It is mentioned in the Bible, but I dont remember where, but when I find out and I will tell you.
The part where Lucifier tries to overcome God and take over him, is mentioned in Isaiah 14: 12-14 and in Ezekiel 28:17 This is when God throws him down from heaven along with his followers.