TL;DR
Miley Cyrus, FL Studio, Sirius XM, and electronic music festivals.
First one is just to get your attention :^)
2020 Update: Something I didn't realize when I wrote this answer in 2016 is that this experience—of electronic music going from shunned to mainstream—is specific to a narrow generation of those born in the late 80s and 90s. We missed the time of synths and grew up only knowing grunge, rock, metal, and hip hop. So the shift to electronic music in our teens and early 20s was surprising to us.
1. OP means EDM, not electronica in the modern sense. But it was called electronica and techno in the 2000s. The distinctions we know today aren't the same as what existed back then.
So in this post, I'm talking about EDM. Not Prodigy, not Aphex Twin. Not The Postal Service, or Royksopp. All of which one might consider "electronica". I'm talking about "four-to-the-floor," danceable electronic music, whether you keep your hands at your sides and stomp your feet with a cigarette in your mouth or hold your hands up through 128 measures of euphoric breakdowns.
EDM is a relatively new word, though. I never heard it until the early 2010s, and some sources support this:
By the early 2010s the term "electronic dance music" and the initialism "EDM" was being pushed by the U.S. music industry and music press in what was largely an effort to re-brand U.S. rave culture.1
(I'm not as cynical though. I think the media needed a word for a phenomenon, and "EDM" stuck with the people.)
Anyway, what did we call EDM in the 2000s, then?
Most people knew it as techno. The general population in the 2000s didn't really distinguish subgenres of electronic music like we do today. There just wasn't enough critical mass of each variety to need more words. If it sounded like video game music, it was techno. Today, you would probably never associate EDM with video games, right? Back then though, the sound of a basic synth was heavily tied to video games, to Americans at least.
Some knew it as electronica, too. In that era, this was the reigning umbrella term, synonymous to us saying electronic music. I believe it was spread by niche "electronica" websites (the Geocities type) as well as the now-defunct garageband.com and other amateur music production sites, where artists were asked to pick from a scanty list of genres to classify their creations—often it was a choice between techno, dance, and electronica.
In high school and college, though I can't speak for the older demographic, listening to this "techno" (outside of playing Dance Dance Revolution) was scorned, and labeled you as some cross between a nerd gamer, weeaboo (e.g. anime lovers), and goth (not makeup-wise, but reputation- and fashion-wise). It really was a "closet" genre as OP put it. I kept my Kazaa / Morpheus (pre-BitTorrent) finds to myself.
2. A look at nightlife 2000s versus 2010s: Things definitely changed, besides graduating from college and suddenly embracing the mainstream.
Maybe that wasn't the case everywhere, though. I grew up in upstate New York, and the data points I have outside of this region is a friend from NYC and another from Des Moines, all of whom experienced the uncoolness of techno. But perhaps in a city like Miami, which has hosted Ultra Music Festival (UMF) since 1999, or cities with huge entertainment industries like Vegas, NYC, and LA, there might have been less of a stigma against techno. I don't know. Regardless, I still don't think nightlife was dominated by techno.
For an adolescent growing up in the 2000s, "going to the club" meant: hip hop and punk. Wasn't it about the same for adults, though? Sure, I know techno venues were available, like the legendary Limelight in NYC. But I don't think they were mainstream. In 2016 now, when my friends want to go to "a club," chances are there'll be some DJ from Berlin spinning minimal or tech house, wherever we end up going. I don't think this is how things were 10 years ago. [Coming back to this post several years later, I think I missed something. I think the mainstream shift to grunge, rock, and hip hop in America naturally caused kids born in the late 80s / 90s (I'm '87 and I'm guessing OP is '88) to never have experienced the electronic era that just preceded them. That's why it felt so stigmatized amongst our peers and why it appeared completely new in the 2010s, to us.]
That's why I don't believe it's just post-college migrations or what every age cohort goes through. The mainstream changed dramatically in America, EDM coming to [re-establishing itself in] the forefront of nightlife as well as mainstream outlets, and becoming accessible to a demographic that includes grade school and college, finally busting the 2000s' stigma against techno.
3. Mainstream's evolution in the early to mid-2000s.
In the early 2000s, amidst a lot of R&B, boy bands, this guy, there was Britney Spears, Christina Aguilera, Outkast, and such artists whose music revived a bit of the "dance" aspect in mainstream. Maybe not quite four-to-the-floor, but the production was increasingly picking up elements that already existed in "modern" electronica: compressed kicks, percussive delays and verbs, synths and pads. There was also Daft Punk, though, in my neck of the woods, they didn't get big until their Discovery album in 2005 (and gained another surge of followers post-Kanye); and Eric Prydz's Call on Me, which played about 5 times a night at any given fraternity. I believe that both of these artists, while trying to go "retro," helped bring the future.
I think it's possible that these developments in the early to mid-2000s may have "primed" Americans—even those who don't typically listen to the radio—to embrace a more energetic and constant style of music, in contrast to rocky, funky, or hip-hoppy variants also competing for the mainstream of that era.
In my last year in college, 2008, I was doing homework with a friend, when she put on Miley Cyrus's "See You Again". If you play it, you can hear what an intermediate this is between the budding semi-EDM mainstream of the 2000s and the EDM we have now—besides the four-to-the-floor, the "and of" kicks reminiscent of techno, the saw bass (nowadays mostly recognized in dubstep).
The evolution of electronic music technology in the 2000s.
Let's skip over to another side of things: production.
By now, we've all heard of or used FL Studio. In 2007, it was enough to send a bedroom producer to MTV, remember?
FL Studio is very easy (and pretty) to use. With a plugin called Soundgoodizer...
...you literally pick A, B, C, or D, and turn the dial for intensity, and it will inject umph into your kick and bass, while filling the headroom to make your track sound wide and full. All without a drop of audio engineering knowledge.
Such innovations attracted a large following of music hobbyists who wanted to try their hand at production. One of them was Alpha 9, now known as Arty, who release his trance tracks Bliss and Come Home in 2009 and 2010, both produced on FL Studio. Many migrated to more "professional" DAWs like Ableton, Logic, and Cubase, further dismantling the perceived wall between the home versus industry user.
Besides FL Studio, plugin developers were writing some great software. The famed mastering plugins iZotope Ozone and Mercury Waves were both released between 2005 and 2007. LennarDigital Sylenth1 came out in 2007. Native Instruments Massive came out in 2007. Everything happened in 2007, and I'm not even cherry-picking yet.
(Maybe producers at multi-million dollar studios were also noticing these new technologies, and that was part of the mainstream pop transition. But probably the bigger factor was that EDM-ized music was selling more records and views.)
Satellite Radio
One last piece before we tie everything together.
In most locations in America in the mid-2000s, there were probably no FM stations dedicated to electronica. But EDM was already playing on a station called The Beat (now known as BPM), and progressive house and trance were playing on a station called Area 63/33 (now known as Electric Area).
When Sirius and XM merged in 2007-2008, there was a surge in subscriptions, further increasing access to electronica, whose content was dominated by European DJs such as Tiesto and Armin van Buuren.
Recap
So, throughout the 2000s, mainstream music began to adopt more and more elements of EDM production, God-knows-why. By the late 2000s, billboard charts were full of four-to-the-floors; DAW technologies boomed, everyone and their mother became a bedroom producer, including Madeon, who was just two years old at the time; by 2010, Sirius XM made BPM and Electric Area available to 20 million American subscribers.
Electric Zoo, NYC, 2009
I know, UMF and EDC were two electronic music festivals that were always there, and probably others. But, for most Americans far away from Miami and LA, these events were something like how we might view Ibiza or Amsterdam: a trip. That is, a trip that you actually plan, to go party somewhere, where they're gonna play "party" music, which you normally don't listen to at home, because the closest thing you know about is mainstream pop, or whatever.
But in 2009, the first Electric Zoo changed that for New Yorkers.
Even then, I didn't have any friends who (admitted to) listening to electronica, save one. I definitely felt the stigma and scorn against listening to electronica in high school, just as OP did. One day, my younger sister, who I wasn't very close with, asked me if I was interested in going to a music festival. She then cautiously revealed it was an electronic music festival. We were both weirded out that we had both been listening to electronic music in secret for all these years—she, too, felt like she couldn't tell anyone.
Anyway, we bought our passes and went, and had an amazing time. The next morning, I saw articles about the event in every tabloid, and people talking about it at work. Some kind of giant light show the whole Upper East Side of Manhattan could see and hear.
The next year, they pushed the mainstage back hundreds of feet to make space for thousands more. The scramble for tickets on Craigslist started a whole month before, and unlike 2009, almost every area, even outside the tents and stage areas, were packed. The transformation happened in New York City.
The rise of electronic music festivals.
In 2011 alone, three more festivals launched: Electric Forest (Michigan), Escape from Wonderland (South Carolina), and Dancefestopia (Kansas). In 2013, Belgium's Tomorrowland launched TomorrowWorld (Atlanta). By this time, all the boutique festivals already directed festival-goers' attentions to the Big Leagues: EDC and UMF. EDC launched EDC New York, EDC Chicago, and possibly others. There's Holy Ship!, whenever that started. Here's a full list.
In the 2000s, going to an electronic music festival wasn't something every kid wanted to do. In the 2010s, it pretty much is, and something almost compulsive, e.g. "Are you going to Electric Zoo this year?". So now there's a strong, social element to add to the fuel.
Conclusion
So, here's my thesis. these are just observations and guesses. One historical account of growing up in America in the 90s and feeling the sudden shift in sentiment toward electronic music that OP did, and just a stand-in until a music historian comes around with a more reputable and objectively researched account.