"Daemon" in computing comes from MIT's Project MAC (1963), where programmers named background processes after Maxwell's demon (1867) — an imaginary entity that sorts fast and slow molecules.
In 1867, physicist James Clerk Maxwell imagined a "demon" that could sort molecules by speed, violating the second law of thermodynamics (it cannot, if you account for its own entropy). In 1963, MIT's Project MAC (Multics precursor) adopted "daemon" for background processes that sort and dispatch tasks — the metaphor was Maxwell's sorting demon. The term survived into Unix (1969), where daemons were the standard name for long-running background processes. The Devil-in-the-machine connotation is intentional but benign: the daemon is a helpful spirit, not a malevolent one.
Daemons are processes that are not associated with a terminal and are usually started at boot time. The name comes from Maxwell's demon, a thought experiment in physics.
— Unix System Administration Handbook (Nemeth et al.), 4th ed., 2010