There's something simple about melee weapons, simple and elegant. Sure, you need to close in on the target (that's more visceral anyway), but swords don't misfire. They don't run out of cutting ammo. They don't have to deal with cover, or range-based minuses, or visibility, or reloading, or aiming delays, or recoil, or villain-attracting noise. With a sword, you're right there. Even swinging blind has a pretty good chance of hitting.
In fantasy games that include power weapons, I've found fusilier often abandoning their muskets in frustration and closing in with bayonets after missing and having to play chimney sweep on their weapons. Or always being stuck in close quarters (like a dungeon). In science fiction games, swords are much better in space battles where gunpowder reactions won't happen (recoil would be a problem regardless), and a blade can mess up a spacesuit with ease. That's why Traveller has them. Star Wars also knows swords are inherently cooler. In superhero games, melee weapons can be part of the hero's equipment without much trouble, but guns quickly send you away from Four-Color action and into anti-hero territory. Even giant mech-bots have swords!
Sure, some genres might have trouble including swords and other melee weapons. Gunless westerns, cops'n'robbers, military campaigns, the historical realities pretty swordless. (And yet, you have Zorro, police batons, and Marines with swords.)
So we're really left with three advantages to guns:
-Damage (some of the bigger artillery certainly outdoes blades in that department, though pistols aren't normally much more effective in game terms)
-Guns are possibly harder to dodge at close range, but do the game mechanics reflect that? Not always.
Are they worth the trade-off though? Depends on the game. Rules-lite games may not draw much of a difference between melee and ranged weapons - choose target, roll for success, score damage. More complex games will, and that's where guns become less successful. And usually less spectacular. And I do like my combats to be spectacular.
Or maybe, as a GameMaster, I just don't want to deal with calculating all those bonuses and penalties...
Mount a defense of the opposite view, why don't you?