In Borderlands 2, weapon prefixes are generated in several tiers, with the highest-tier prefix overriding all others. Each manufacturer has its own group of prefixes.
The three main groups of prefixes are the accessory, element, and grip prefixes. The accessory prefix occurs on guns with an accessory part, such as a foregrip. All Legendary, Seraph, and Pearlescent-rarity weapons will always have an accessory, as will all non-unique purple-rarity guns. Green and blue guns have a chance to spawn with an accessory, while white guns never will.
If a gun does not have an accessory part, its prefix will next be determined by its element, if it has one. Because Jakobs and Torgue weapons are never elemental, they will never have an element prefix. The unique Stinkpot, Greed, and Twister have special prefixes, as discussed below.
If a gun has no accessory or element, its prefix will be determined by the manufacturer of the gun's grip part. Certain grips will cause guns to not have a prefix at all. Because Maliwan weapons are always elemental, they will never occur with a grip prefix.
Certain unique weapons have special prefixes, such as "Miss Moxxi's" or "Gearbox." Depending on the weapon, unique prefixes will typically override the grip or elemental prefixes, but be overridden by the accessory prefix if the gun has one.
Certain titles of weapons also have special prefixes that will override the grip prefix, but be overridden by the elemental or accessory prefix, e.g. a Dahl Minigun will always have the "Nonuple" prefix if it does not spawn with an element or an accessory. Note that this does not necessarily apply to unique weapons of the same body and barrel manufacturer. For example, Bandit Room Clener shotguns have the special prefix "Threpul" which overrides the grip prefix, while the unique Jolly Roger can occur with an ordinary grip prefix such as "bandity." The same is not true of all unique weapons; for example, the RokSalt may occur with the prefix "Duble Bareld," which is the special prefix of generic Stret Sweper shotguns.
Gemstone-rarity weapons will always apply their manufacturer prefix, overriding all others.
²The Bandit/Scav Rocket Launcher grip provides a hidden melee bonus, and its prefix will override any element on the gun. Although it appears outwardly similar to the other bayonet accessories, it is in fact part of the grip and does not take up an accessory slot; any accessories that spawn on the gun will override the grip's prefix.
Laser prefixes are determined solely from the weapon's grip and element. The presence or absence of an accessory (rare, on a laser) has no effect on the weapon's prefix.
Incendiary lasers, the most common variety, take their prefix from the manufacturer of the grip part. Note that on a laser, the grip part extends horizontally from the left side of the foregrip, where it is difficult to identify in profile. The easily profiled handgrip on the rear of the weapon is part of its buttstock, which affects the weapon's recoil and handling, but not its name.
Lasers of other elements take their prefix from their element, disregarding the grip manufacturer.
Prefix: Regarding the mechanics of Prefixes in Borderlands.