It comes from Harry Potter. Those were the words needed to unveil the "Marauder's Map", which was a thorough map of the Hogwarts castle and grounds and could show the location of people within the land. Without those words, the map would otherwise appear as a blank parchment. To again hide the map, one would say, "Mischief managed!" Of course a magic wand was also involved.
The creators of the map were a group of teen boys (Harry's father and his schoolboy friends) who quite liked pranks and the idea of adventure. Hence the words involved. They also benefited greatly from a way to hide from teachers and get through secret passageways, hence the map's creation. ;-)
As for the popularity, well Harry Potter fandom in itself is huge of course. But the words have spread to have a broader meaning than just a quote. It can be a fun reference in fantasy loving circles (such as Ren Fest) and has the qualities of an internet meme: even in groups with no particular feelings toward Harry Potter one might say "mischief managed" to end a jokingly devious story or tease the "I solemnly swear..." bit when talking about guilty pleasures or things we want to do but shouldn't do. Just as a couple examples.