You would think we would be running out of riffs by now. There are only so many notes and chords to put together, and so you would think that the vast horde of professional and aspiring guitarists would have found them long ago.
Which makes the easily recognizable riff in Megalovania surprising. It is catchy and recognizable. And it, and the rest of the song "Megalovania" was composed by a 17 year old high school student who was making a hack of the SNES RPG EarthBound. In 2008, Toby Fox released a hack of Earthbound for a Halloween contest on the site Starmen.net. Along with reusing the original EarthBound music, (which is generally rated as one of the best video game soundtracks), he also wrote several new songs for the hack, one of which was "Megalovania". Although it is not based on a specific EarthBound song, I would say it in inspired by the overall sound of that game.
In general, while it was well-received within that community, the "EarthBound romhacking community" is not a large enough launching pad to bring a song to worldwide fame. Luckily, shortly afterwards, Toby Fox joined the music team of Andrew Hussie's webcomic Homestuck. In early 2011, the song was used to illustrate a flash animation. It was well received by the followers of Homestuck, a larger group.
But the song's popularity really increased in 2015, when Toby Fox released Undertale, an indie game that quickly became a web sensation, one of the most critically acclaimed games of 2015, and has become a cult classic in the years since. He also included "Megalovania", (in a slightly different version), and it is this version that caught the attention of the internet. It is a perfect piece of video game music, with a driving, insistent riff, and a sense of excitement and danger.
There are many different cover versions of the song available on YouTube, including versions of it played on piano, flute, trombone, french horn, calculator, glass of water with spoon, floppy disk drive... as well as more serious performances by jazz bands or chamber groups. This is mostly based on the easily recognizable aspect of the song's main riff, although there is more to the song than just that.
Somewhat ironically, Megalovania is probably not one of Toby Fox's better songs, with many of the songs from the Homestuck and Undertale soundtracks showing more musical development, more subtle use of themes, and (especially after repeated listenings), less annoyance than Megalovania. It might become something like Stairway to Heaven is to Led Zeppelin: an easily recognizable song that doesn't really demonstrate the scope of the artist's ability.