One is specific, one is general. They're the same role: to adjudicate the rules, arbitrate between players, and facilitate a great experience at the table! “Dungeon Master” is considered “the original” by some; it is the official Dungeons & Dragons term for the role. But there are lots of different games! Dungeons & Dragons is a great sword-and-sorcery adventure game, and it's great for stories like Lord of the Rings or Game of Thrones, but there are games for all sorts of genres. Games for stories like Star Wars and Firefly; games for stories like Indiana Jones and Lara Croft; games for stories like Stranger Things and The Goonies… There are even other games for stories like Lord of the Rings and Game of Thrones! For all of these, the term “Game Master” applies nicely.
The term “Game Master” can also apply to someone leading or teaching other games! For many games, learning from the printed instructions is a confusing slog. With the right teacher, the learning process goes from frustrating to fun! Hiring a GM is a great way to find that teacher when you don't already have one nearby.
“Dungeon Master” is just Dungeons & Dragons's term for “Game Master”. At the end of the day, they're the same thing!