The vision of cosmic struggle, forces of good contending against forces of evil, derived originally from Jewish apocalyptic sources and was developed by sectarian groups like the Essenes as they struggled against the forces they saw against them.
This revision of earlier monotheism also involved a split in society, divided between ‘sons of light’ against ‘sons of darkness’. Followers of Jesus adopted the same pattern. Each of the gospels in its own way invokes this apocalyptic scenario to characterize conflicts between Jesus’ followers and the various groups each author perceived as opponents.
The Devil does not come from Judaism, it is rather a pagan influence. The Zoroastrians believed that there were two gods, one good and one evil, in constant opposition and competition for human souls. Zoroastrianism influenced Judaism during the time period before Christianity arose.
In no part of the canonical books of the “Old Testament” are we given the Devil in the Christian sense—the once favored angel that sought to lead a rebellion to overthrow God, was cast from heaven into hell, and now seeks to tempt/trick/torture human beings in opposition to God’s will.
The term ha‑Satan means literally the‑Adversary, and the term is used in a number of contexts that mean adversary in general. The closest thing that we find to the Christian concept is its use as the title (though not the name) assigned to an angel in Yahweh’s court.
He was a prosecutor for God against human individuals, with God as the Judge. Ha‑Satan could not act without God’s permission and did not cause people to sin, though God may have ha‑Satan test a person, as in the case of Job. Ha‑Satan’s primary role was to record and point out the sins people committed and argue against them in the holy court in accordance with God’s will. In the (apocryphal) book of Enoch, Satanael/Samyaza is the leader of the Grigori, who again were cast out of heaven for sleeping with human women and producing a race of giants.