Good question and the honest answer is: we don’t know. Much about demons are shrouded in mystery; all we know for sure is what’s been recorded. Here are theories:
- Christianity provides an answer (there is no way to tell for sure if they’re right so don’t get upset on me): they’re fallen angels. At some point, there was a war in Heaven that Lucifer (now Satan) led against God. A number of angels sided with Lucifer (who wanted to be God, according to the story) and God cast them out of Heaven onto Earth and/or took away their bodies at some point. It is said The Flood could have destroyed their bodies, which is why they reside in the spirit realm.
2. In the Book of Enoch (an apocryphal text, considered not canonically part of the Bible as folklore), it expands on a mysterious passage of the Bible: Genesis 6 explains that the “Sons of God” came to the earth, saw the human women were attractive and mated with them, creating giants on the earth which were half-human, half-something else. It’s unclear what the Bible means by the Sons of God, though it’s commonly interpreted as being angels (perhaps even fallen angels but it’s understood God was upset about this). However, translations then tell us that they were a lesser form of deity sent to the earth to watch over humanity. The Book of Enoch expands this story, calling these beings “The Watchers”. The Flood wiped out these children, which are called The Nephilim.
3. They are spirits from another iteration of the earth that possibly also died in the Flood; there’s clear evidence that the Flood happened, religious event or not. Maybe God rage-quit the earth a few times, creating different types of beings each time (the rainbow in the Bible just signaled that he was finally going to stop-it never specified whether God had done this before). Perhaps they existed already at creation. There’s no way to prove it, but it does give an explanation to the different types of spirits existing on the earth together.
4. Pre-Adamic race/spirits of the dead. There was a movement that read between the lines of the Bible, explaining that there was a race that existed before Adam, but has since died out. It’s also been believed that they are once-human spirits who were evil on earth (this seems unlikely since demons are clearly stronger/smarter/can do things humans cannot).
It’s up to you what to believe. Demons already are bound up in Christian religious icongraphy already, but it’s entirely possible they aren’t religious at all (this doesn’t seem likely since they react so negatively to Christian iconography like crosses, holy water, etc.); what I’m acknowledging is that we don’t have all the answers to your demon questions. All I truly know from my research is that there are identifiable patterns in the way they behave/in their abilities from the firsthand experiences of people who have encountered them.
Jaye, Victoria, “In the Presence of Evil: Demonic Perception Narratives” (2021). All Graduate Plan B and other Reports. 1563.