Think about all the fiction you've read that refers in passing to real companies, brands, sports teams, games, and so on. All of those things have trademarked names, yet you can have a character drink a can of Coke while watching the Red Sox play before heading out to Cinemax to see the latest Star Wars film.
Some writers do alter names; the characters wouldn't play Dungeons and Dragons but Wizards and Monsters or something like that. You can alter the name to play it safe, but using real references for fiction set in the real world adds ways for readers to connect with what you're writing. Familiar references are, well, familiar. When I read a story that mentions things that are clearly real-world things with the serial numbers filed off, I sometimes wonder if the story is actually set in an alternate reality. Sometimes it is and that's the intended effect, but it sounds like you want your story to be set in a place where people play D&D.
So have them play D&D. Don't violate the publisher's copyright by reproducing significant text from rulebooks and modules, but wizards were casting fireballs long before Gary Gygax came along, and your characters' characters can do so too.
If you are going to cast any real-world product or person in a negative light, you should give some thought to whether it's important enough to deal with possible nastygrams from lawyers. If your story is about how the game warps players or something, you'd be better off calling it Demons & Dopplegangers or something like that. But for passing, non-negative references, it's fine to have your characters play real games, watch real movies, use real products, and so on.