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!"
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.