It's called a bayonet, I believe. There are a variety of styles, some of which are basically knives or small swords stuck to the end (but away from the barrel) of the rifle.
A game called Darkwatch came up with some fun designs featuring gunblades if you wanna check those out. Generally speaking, however, swinging a sword and firing a gun aren't two tasks which tend to complement each other. You also have to take weight into account. The heavier the blade the more lopsided the gun, which impacts accuracy. Even if they could balance the gun out again, it'd be much heavier.