For me it was a gradual exposure to the game over several years.
I think that I first became aware of D&D when he got the first AD&D game cartridge for our Intellivision. Either that or from seeing the Saturday morning cartoon.
When I was about 10, I got really into the Choose Your Own Adventure books, which my mom would find at garage sales for me. One time, she picked up a handful of similar books, called Endless Quest. I really enjoyed those ones. Around that same time, I was also reading a lot of Star Wars and G.I. Joe comics, which frequently included ads for D&D.
By the time I was 12, I started looking at the D&D books and boxed sets in book stores, as it looked really cool to me. Later that year I was at a scout camp and one of the older boys had brought his D&D books and ran a game for a bunch of us. I was immediately hooked.
Right after that camp, I went and bought the (Mentzer) Basic Set with that iconic red dragon on the cover. A few weeks later, I bought the Expert Set, and I think by that Christmas I had the core AD&D 1e books.