We can trace the origin of demons in the Bible. They were once angels who rebelled and then cast out of heaven:
“For if God did not spare angels when they sinned, but cast them into hell and committed them to pits of darkness, reserved for judgment;” (2 Peter 2:4).
While many controversies surround the details of this passage, it is clear that demons were angels who sinned.
Regarding some of the minor points, the Bible just doesn’t make it clear. The majority of the Bible focuses on God and His relationship with man.