Devanagari developed from Gupta via an intermediary script called “Nagari” which has very little information about it available. “Nagri” means “urbane”, so presumably it was used for commercial purposes. “Deva” means “deity”, so calling the derivative script “Devanagari” presumably was to recognize that this script was used for both commercial and religious purposes.
Nagari became distinct from Gupta in about 700 AD; Devanagari became distinct from Nagari in about 1000 AD, but didn’t get a separate name until later.
Devanagari is closely associated with Sanskrit, the language of both Buddhism and Hinduism. Many people think that Devanagari is “the” writing system of Sanskrit, Buddhism, and/or Hinduism, despite the fact that Sanskrit, Buddhism, and Hinduism all predate Devanagari. People used whatever writing system happened to be around. (And people even now still write Sanskrit with the Tibetan script.) There are also many languages other than Sanskrit that were and are written with Devanagari, including many Indian languages, most notably Hindi. (While Devanagari readers are in the minority of all of the world’s readers, it’s a big minority.)
Devanagari is a pretty standard Brahmi-derived abugida, but has an unusual punctuation symbol, the avagraha. The avagraha, which looks like a Latin “S” is used to show vowels that have gotten lost by being smooshed together, and also for vowels that have gotten extended. If English used “S” as an avgraha and if English spelled things like they were pronounced, you might use the avagraha in the first way to write “ISscream” to show that even though it is commonly pronounced “I scream”, you really mean “ice cream”. For the second use case, imagine a kid yelling for his mother: “MaSSSSSSSS!”