Where did satan come from?

Jason Smith   -  
διάβολος diabolos – devil – slanderous and backbiting.
Hebrew name שָׂטָן (satan) derives from the verb שָׂטַן (satan), which means to be or act as an adversary.
Scripture teaches us that Satan wasn’t always the adversary. In fact, years and years and years ago, Satan was actually an angel, one of God’s best and most beautiful angels, known as Lucifer, or often called the morning star.

What happened?

Satan rebelled against God, he wanted to be like God, and he wants to lead as many to join that rebellion as he can.
He wanted to be like God, Lucifer, this morning star, the beautiful angel said, “I will, I will, I will …” Five times in this passage we see this angel wanting to be like God.
12 “How you have fallen from heaven, O star of the morning, son of the dawn! You have been cut down to the earth, You who have weakened the nations!  13 “But you said in your heart, ‘I will ascend to heaven; I will raise my throne above the stars of God, And I will sit on the mount of assembly In the recesses of the north. 14 ‘I will ascend above the heights of the clouds; I will make myself like the Most High.’ 15 “Nevertheless you will be thrust down to Sheol, To the recesses of the pit.

God cast him out of Heaven, and a third of the angels followed him.

Most believe these became the demons today.

Rev 12:7-9
7 And there was war in heaven, Michael and his angels waging war with the dragon. The dragon and his angels waged war, 8 and they were not strong enough, and there was no longer a place found for them in heaven. 9 And the great dragon was thrown down, the serpent of old who is called the devil and Satan, who deceives the whole world; he was thrown down to the earth, and his angels were thrown down with him.

When were Angels created??

gives a little insight into that..

Job 38:4-7
4 “Where were you when I laid the foundation of the earth? Tell Me, if you have understanding, 5 Who set its measurements? Since you know. Or who stretched the line on it? 6 “On what were its bases sunk? Or who laid its cornerstone, 7 When the morning stars sang together And all the sons of God shouted for joy?
The “morning stars” are the angels… when God made the earth… they assembled as a choir celebrating the greatness of God.
The angels are created before the earth. The rebellion and eviction … happened after God created the earth and before Gen 3