Yes, guns arrived because - like crossbows before them - they were easier to use than a sword or a longbow. Not because they did super damage.
I don’t agree that a bullet wound is harder to treat; a sword will mangle up your insides just fine; and you’re not reattaching a dismembered hand. But I’m not a doctor, so if any doctors here say otherwise I’ll take their word for it.
Savage wounds from either type will obviously kill, but not all sword attacks are going to be that savage. Your opponent can still move out of the way (or try), and armor can protect even more. End result is a lot of cuts and stabs that -- provided they didn't directly hit something important -- can be treated pretty effectively. Guns, on the other hand, have bullets that enter the body and then tumble around into various muscles, bones, and organs, usually resulting in pretty major blood loss and often pneumothorax if it's the chest. Unlike with swords, you can't really dodge bullets and the effectiveness of armor is overall weaker compared to the attack. Furthermore, when talking about rifles, you might not be dealing with a *single* wound. You could be hit several times in different places with that one pull of a trigger. You're also talking about a weapon that can bypass the "natural" defenses your body has to protect internal organs much more effectively (rib cage, arteries nestled within muscle and tissue, etc). A sword cut to the leg needs to be pretty deep to turn lethal. A gunshot just needs to hit and it has a good chance.
Another way to look at this would be (assuming we eliminate the obvious insta-kills like a headshot or beheading) to compare treatment methods. Stabbing and slashing wounds often involve stitches and possibly minor surgery. Gunshot wounds usually always involve intensive surgery.