When exactly God created angels is open for debate, but what is known for sure is that God created everything good because God, in His holiness, cannot create something sinful. So when Satan, who was once the angel Lucifer, rebelled against God and fell from heaven (Isaiah 14; Ezekiel 28), one third of the angelic host joined his insurrection (Revelation 12:3-4,9). There is no doubt these fallen angels are now known as the demons.
We know that hell was prepared for the devil and his angels, according to Matthew 25:41: “Then He will say to those on His left, ‘Depart from me, you who are cursed, into the eternal fire prepared for the devil and his angels.’” Jesus, by using the possessive word his makes it clear that these angels belong to Satan. Revelation 12:7-9 describes an end-times angelic battle between Michael and "his angels" and the devil and "his angels." From these and similar verses, it is clear that demons and fallen angels are synonymous.
Some reject the idea that the demons are the fallen angels due to the fact that Jude verse 6 declares the angels who sinned to be "bound with everlasting chains." However, it is clear that not all of the angels who sinned are "bound," as Satan is still free (1 Peter 5:8). Why would God imprison the rest of the fallen angels, but allow the leader of the rebellion to remain free? It seems that Jude verse 6 is referring to God confining the fallen angels who rebelled in an additional way, likely the "sons of God" incident in Genesis chapter 6.
The most common alternate explanation for the origin of the demons is that when the Nephilim of Genesis 6 were destroyed in the Flood, their disembodied souls became the demons. While the Bible does not specifically say what happened to the souls of the Nephilim when they were killed, it is unlikely that God would destroy the Nephilim in the Flood only to allow their souls to cause even greater evil as the demons. The most biblically consistent explanation for the origin of the demons is that they are the fallen angels, the angels who rebelled against God with Satan.