Dungeons and Dragons is just one game among many
There's many Tabletop Role Playing Games out there. Of course, there's Dungeons and Dragons, one of the oldest games on the block but it's not the only one. Some consider it ok to refer to the hobby of TTRPGs as a whole as just "D&D" but it could upset some stomachs to do so, so it's better to just refer to the hobby in general as RPGs, or TTRPGs. That's why we are named rpg.stackexchange and not D&D.stackexchange.
Just to name a couple of big game names, there's Pathfinder, Shadowrun, Cyberpunk 2020, Legends of the Five Rings, the World of Darkness, and Chronicles of Darkness... A whole host of different games, and dozens upon dozens of editions!
Each game has its own style, many have their own mechanics... But it's a jungle to fight through if you lack a guide. So, if you allow, let me give you a pointer or two, so you can find what you like in this jungle of options.
What is a TTRPG and how is it played?
A Tabletop RPG is a game. The basic concept is that you and others meet up - be it in person or online - and then narrate a story. One of the people around takes the role of lead narrator, everyone else picks a specific character's role. Some games call that lead narrator the Game Master, Dungeon Master, Storyteller, or simply Narrator. They will play the tell you about the world and how every person or monster you find there reacts to the things you tell your character does. The other players all have their characters, and in return tell the GM and the other players what their character does, thinks or says. Let's listen in on Alice, Bob, David and Florence:
GM Alice: Ok, you are in the hamlet of Malchir. There's a road, three small huts, a horsecart and a handful of farmers.
Bob: "My barbarian Cohen walzes down the road and yells to one of the farmers, that he wants to know where the next dragon hides."
David: "Esmeralda Weatherwax, witch, groans as Cohen does the Barbarian stuff but follows along. When he is finished with yelling at the poor lad, she smiles at them and says: 'Sorry, he hasn't fought one in weeks. I bet he'd be content with some ale and a direction to any adventure to be had.'"
GM Alice: "Eh, ok. The Farmer stares back at Cohen, sweat gathering on his forehead before he quickly nods to Esme. He's lucky to wear brown pants it seems. 'I can tell my wife to get you some beer, and I heard there's a troll up in the mountains that way...' he stammers.
Florence: "As the word Troll falls, a screaming guy rides by on the most strange ride. It's a chest with hundreds of tiny feet, and the young man riding it is all while in the face, one hand holding his blue pointed head with the letters W I Z Z A R D..."
Well, let our friends (who clearly play in some kind of Discworld setting) alone, we intruded enough. So, the basic idea of a TTRPG is, that you tell a collaborative story together. But whenever something is to be done, when you don't exactly know if it will succeed or fail, you resort to a method of organized randomness. The most typical method is dice. Different games use different dice, and they also differ in what is a good outcome or a bad, but that is all game-specific.
But I guess that's it in a very abstract way: A TTRPG is a cooperatively told story where you at times roll dice, and D&D is but one of those games.
So, you want to play a Game...
Choose a Game-setting!
The first step, before you start with just buying rulebooks and trading money for dice is at least getting an idea of what you want to play. Because not all systems cater to everything!
Do you want to play in a tolkinesque Fantasy world or do you live for the grim and thirty Warhammer Fantasy where you slay Skaven to protect the Emprie of Karl Franz? Does being part of Cyberpunk Heists tickle your nerves? Is your palate is after gritty Corporate-Survival or do you fancy a Samurai-drama or do you seek the Grimdark future of Warhammer 40.000? Might it be a dark Urban Fantasy world you want or would you rather play in the Star Wars universe? Do you want to fight villains with Iron Man or explore the final frontier to boldly go where no man has gone before?
All of those are possibilities and there are many many more! There are games published for all of these types of settings and more, and often there are even multiple games in the same genre.
But where can I learn about...
You've chosen a style of game you want? Great! Now, you actually need to find a game that fits that.
If you want generic fantasy, you might feel interested in Dungeons and Dragons, because that's the general style that the published material is meant for. Or you reach for its counterpart Pathfinder. Both are games with their own strength and weaknesses, both have fans. And that's fine.
If you want to play a game with anthropomorphic animals exploring space after the earth was destroyed by a nanite weapon... well, good for you, even that kind of niche game exists. Yes, that's the synopsis of HC SVNT DRACONES. No, that's not a spelling mistake, yes the game is named "here be dragons" in Latin and all caps. And if it tickles your interest, that's fine too.
But where can you learn about a game that caters to what you want? Well, one of the first steps might be to look around in one of the larger forums dedicated to the hobby. We curate a list of many such places. Or you join us in chat and explain to us what kind of world you want to play in. Or you visit your local game store.
Ask around, and inform yourself, but don't impulse buy all the stuff!
Legal Disclaimer: Piracy of books is Copyright Infringement and costs a lot if you are caught.
Ok, I have decided on... Can I buy stuff now?
Once you are sure you know what kind of game, or even the exact system you want, you can start to look for a group. The above-mentioned forums are a good place to start or a dedicated discord for gaming or the system you want. Familiarize yourself with the people, and about now is the time to buy the absolute bare essentials. If you already got a group now, ask them what you need as the absolute minimum, but don't let yourself be fooled. It shouldn't be more than one or two books, or a single box, which you need to start with any TTRPG.
It's generally cheaper to buy the PDFs, and https://www.drivethrurpg.com/ is most likely the biggest pdf retailer, even for games that are out of print today. Hardcovers can be acquired via Amazon, your local bookstore, or a game store.
Then you need the dice. If you play using a VTT or buy a starter Box, you don't need extra dice, as you get those with them. Otherwise, you can get those via Amazon and the game store, but Make sure to get the right dice - not all games use the same!
I got my stuff, where can I find a group?
Many ways! As suggested, you might already have joined one of the forums or discords to learn what kind of game you want, so you might as well peek into the LFG (looking for group) section and read some ads there. Ask if they are beginner friendly. You might even do this before you have your full equipment, often people are helpful and will offer to lend you their books or dice for the game nights. Or you use a Virtual Table Top anyway, which does provide the dice on its own.
Your local Game Store might have a notice board with group ads, or the shopkeeper knows a group or two. They might also offer their cellar or back room for gaming nights in a public space.
Or your school or a local university might have a game club, which in my experience offers a great chance to test out various games.
And also read this oldie but goldie question: How can I find other RPG players?
Stay safe!
Last but not least, always remember:
A white-haired elf with chrome shades: "Never deal with a dragon, choose your enemies carefully, and find your own truth."
Cut the dreck Dodger!
What I wanted to say: Stay safe in your search for a game you like and want.