Up until 4e, DnD (and TTRPGs in general) were pretty much only spread through the game itself. You either knew someone who played, or maybe you heard about it on the internet and you were interested so you sought out a local game shop, something like that. Regardless, your first experiences with what DnD was like (ignoring fear-mongering movies and other negative media) was likely to be from playing it.
That seems to have changed with 5e. DnD media is bigger than it's ever been. Actual play podcasts and shows are everywhere. Speaking personally, though I had been in lots of LGS from playing a ton of MtG growing up, my first direct exposure to DnD was finding The Adventure Zone (way back when it first started as a "one-off" side thing from MBMBAM). From there, I learned about Critical Role, and it only took a few watches of that before I resolved to actually find a group to play with.
How about everyone else? Did you get into the game because a friend invited you to play, or did you get hooked on some DnD show and decide "I want to do that, too!"
I played the Baldur's Gate games when I was a kid. My parents wouldn't let me play "that devil game" on the tabletop but were perfectly fine letting me play all these different CRPGs. Then I started playing table top in high school and my parents freaked out. My mom thought I was being possessed.
Long story short. I'm still playing D&D and my mom still thinks I'm going to hell.
I first got into d&d in the mid 1980s through a group that played at the library. Played that very briefly until they kicked us out for being Satanists.
...when i moved to the `states in `80, i overheard all the kids at the bike racks after school talking about their 'armor class' along with various swords and figured huh, i guess fencing or kendo must be the popular sport for kids here in the `states, like soccer clubs back in ponce...later that fall, thanksgiving, a couple of older cousins introduced me to D+D at our grandparents' house and i suddenly made sense of what all the other kids were discussing back at school, after which i started playing in earnest in `81, but it was just that: a strange tabletop game with obscure rules, exotic dice, and ambiguous objectives...
...merchandising really kicked in the following year with action figures in `82, a cartoon in `83, and somewhere along the way i could start finding game material at waldenbooks rather than the back corner of our seedy local hobby shop populated by middle-aged scale-model enthusiasts...by `84, D+D was everywhere: local libraries maintained subscriptions to dragon magazine, dragonlance novels took the fantasy genre by storm, and you could find notebooks, stickers, and other branded paraphernalia at any local drugstore...
...so for me, the game came first and media second, but the mid-eighties media presence felt every bit as prominent or perhaps even moreso than today; it was absolutely dominant in way that only something like fortnite or lego feel right now...
An uncle ran a game back when I was a kid. Remember the old box sets?
He moved away, but left his stuff behind. Guess who was the only one interested in the cool ass pictures out of all the kids :)
So I inherited his stuff by decree that if he can't even bother to answer a phone call, he must not care. And, he didn't, he moved back into the area years later and was slightly stoked that not only did the stuff still exist, but that someone was running games with it.
But, at first, it mostly sat on the bookshelf in my room because elementary school kids are hard to get to sit down and play lol. So I'd kinda play by myself.
Well, that changed as my friend group aged up enough to sit down and roll dice here and there.
By high school, I had found a group as a player, and we ran 2ed because that's what was there at the time. But that group fell apart, and I loved the game too much to just quit, but there weren't any groups because small town life is like that.
So, I badgered my friends into playing. My best friend had an older brother that ran games in college, and had done a few for my friend during summers. So with the two of us, we had enough "mass" to pull in the rest of what would become my steady play group for decades.
During middle school a friend of mine introduced me to Pathfinder 1e. After my family found out they claimed I was practicing Satanism and had various church members visit me to dissuade me from "letting Satan into my heart".
It wasn't until I moved out and headed to college that I got into 5e. One of my freshman classes I met a 5e "Forever DM" and we started gathering a group that played off/on all throughout college. After college most of us stayed in the Seattle area, and I became a Pathfinder 2e DM this year. Currently running a game with some of my old college group as well as colleges who were interested in TTRPGs.
I started early in 5e when a friend from work introduced me. This was before the SRD was dropped. Critical role was still mid 1st season so there wasn't much media yet.
Does Neverwinter Nights count? It was sub-bar D&D online, with janky real time mechanics, built on 3.5e ruleset. If anyone else remembers the persistent server City of Arabel, it was like a smaller scale MMO set in the jewel of Cormyr. I have a lot of neat memories, but its fairly bittersweet because if you weren't in a particular playerbase clique, you were a de-facto NPC.
That was my inroad into D&D. I lovingly crafted busted builds that worked only because of quirks of the aforementioned jank.
As an old dude, my first exposure to D&D was media – the gold-box D&D games, Pool of Radiance, Curse of the Azure Bonds, and Streams of Silver. I bought the 2nd edition PHB because I wanted to know what the hell thaco was.
D&D media came first for me with the Baldur's Gate games, followed by the Icewind Dales and onto the Neverwinter Nights. Didn't roll my first dice until 5e.
D&D. My brother got the AD&D PHB when it came out in '89. Shortly afterward, friends of mine ended up with red boxes (which I thought were a major skip back. I couldn't be an elven fighter, just an 'elf'. lol)
I played all of the Gold Box games in the 90s and nowadays I watch several different TTRPG shows, but my first experience was the AD&D PHB.
There was no media when I started. My first RPG was Chivalry & Sorcery, then Traveller both via my older brother - tbf I just made characters and designed space ships. It was several years later when I found some other players and got introduced to AD&D.
It was media for me. I started reading novels set in the Forgotten Realms, and in one of the introductions of the books there was reference to playing a game. I then found my way into playing AD&D 2E with my friends.
Fifth Edition for me. An old friend from my Mmo days wanted to open a westmarch, and invited me to play. The server has long since shut down, but I was hooked afterwards.
I had always sort of known about since I was a big fantasy fan, but I didn’t know too much. Then about 6 years ago while looking for good podcasts, I also stumbled upon The Adventure Zone. Instantly I was hooked and went down the rabbit hole of CR Campaign 1 and soon knew I had to play for myself. I had an in person game first with a couple friends but that quickly fell apart because no one could meet regularly. But I knew that there had to be some way to do it online so I just googled “play dnd online”. First I got the MMO but Roll20 was pretty high in the results. It was exactly what I was looking for and have since joined multiple campaigns that have lasted years!
When I was a child too many years ago, I was dimly aware that my dad played something cool involving dragons. I had no idea what it was. In retrospect, I think him and his friends just got stoned and looked at the cool pictures and figures.
My memory is a little hazy on the exact sequence that followed, but I got some DND video games. Eye of the Beholder and Baldur's Gate. I didn't know how any of the rules worked (pre-3e is wacky) but I was super into it.
I went to a very left-wing church (UU) and actually got a group to play together through that. It was about as bad as a pack of 13-year-olds is expected to be. To the two adults who volunteered to run this for us, Vera and Mindy, I'm so sorry.
I also remember some random dude in a local-ish game shop who took about 15 minutes to talk to me, an extremely excited 13-year-old, about how D&D worked and while you can do anything in it, not everything is a good idea. Thanks, random dude.
But the TLDR is: Vague word of mouth -> video games -> actual play.
Technically? Media. I had just started watching Community and had seen their Dungeons & Dragons episode. I had also seen a few smaller references to D&D throughout my childhood, like one episode of Dexter's Lab and this Summoner easter egg.
But for the most part, my first real exposure to D&D was when a friend in uni invited me to play in his 4e game.