First you must enter any of the DLC hive(the glowie purple things), once inside search around for the long white weapons cases with the random symbols on them.
Named Legendary weapons only spawn in these and they are completely random, this was the last achievement for me and it was a pistol that I almost didn’t see so be careful and look thoroughly.
You don’t have to be holding any weapon of rarity.
Skull totems don't count even though once you have all three parts it’s listed as a legendary melee.
Legendary weapons are gold and will say legendary and will have a special name.
This can be done on any difficulty, with or without bots.