tl;dr
How did electronic music become popular in the early 2010s?
Miley Cyrus, FL Studio, and Sirius XM, and electronic music festivals.
First one's to get your attention, but still kinda true.
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. By the 90s when we old enough to explore our identities in music, radio and MTV had already shifted to grunge, rock, and hip hop. The entire era of synths and electronica preceding the 90s was invisible to us, except maybe through our parents (but mine were immigrants, for example). So indeed to us it was a surprising shift, seemingly from "non-existent" and abused for listening to it, to a social mainstream.
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," anyone-can-dance-to electronic music.
EDM is a relatively new word, though. I definitely didn't hear it used 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.
I was in upstate New York though, so maybe that wasn't the case everywhere. So I interviewed a friend from NYC and another from Des Moines. Both experienced the uncoolness of techno. But maybe in a city like Miami, which has hosted Ultra Music Festival (UMF) since 1999, or cities with huge entertainment industries like Vegas and LA, there might've been less stigma about techno. Regardless, I tend to believe that nightlife still wasn't dominated by techno.
For a teen growing up in the 2000s, "going to the club" meant: hip hop, maybe punk. In 2016 now, it means a DJ from Berlin spinning minimal or house, anywhere we go. [2020 update: And now it's techno.] That's why I don't think it's just post-college migrations, something every age cohort goes through in the same way.
Mainstream changed dramatically in America, EDM coming to the forefront of nightlife as well as mainstream outlets, and becoming accessible to a demographic that included teens, finally eradicating 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 others 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.
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 mainstream in that era.
In 2008 I happened to hear Miley Cyrus's "See You Again". In it you can hear the budding semi-EDM mainstream of the 2000s as well as the EDM of today—besides the four-to-the-floor, the "and of" kicks reminiscent of techno, also the saw bass (nowadays mostly recognized in dubstep).
4. 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.)
5. Satellite Radio
We're almost there, hang in there.
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. By 2010, Sirius XM made BPM and Electric Area available to 20 million American subscribers.
6. Electric Zoo, NYC, 2009
One last piece before we tie everything together.
UMF and EDC were two electronic music festivals that were always there, and others I'm sure. But, for most Americans far away from Miami and LA, these events were things we might view like Ibiza or Amsterdam: a trip. Something 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. [*For those born in the late 80s and 90s.]
But in 2009, as an example, 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 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.
The next morning, there were articles about the event in every tabloid, 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 main stage 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 precisely between 2009 and 2010.
Then in 2011 alone, three new 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 almost compulsive in NYC, e.g. "Are you going to Electric Zoo this year?". So now we have a compelling social element to add to the mix.
Tying everything together! (2020 Update)
Those of us born in the late 80s or 90s in America missed an entire era of electronica as mainstream radio and TV had shifted completely to rock and hip hop by the time our young selves were exploring our identities in music. Then in the 2000s alone,
- Pop began to incorporate more and more dance elements (but we still couldn't connect it back to the 80s since it was never in our repertoire),
- DAW technologies boomed, and everyone and their moms became bedroom producers (remember Madeon?—he was a toddler at that time),
- and Sirius XM came bundled with cars providing a direct channel to European EDM (it was always big there!) through stations like Area and BPM.
Finally, at the turn of the decade entering the 2010s, there was a sudden explosion of electronic music festivals. I consider these years—between 2009 and 2013—to be the delineation that ushered in the age of modern EDM.