Note: The appearance rate of Legendary enemies increases as you increase the difficulty.
These are special and more dangerous variants of enemies that may appear in random locations. Legendary enemies usually appear in a group of normal enemies of the same type (you'll find a Legendary Raider in a group of ordinary raiders). The exceptions however apply to normally solitary but deadly enemies such as Deathclaws and Behemoths. When their HP bar is depleted, Legendary enemies have the chance to "mutate", refilling their health and increasing their stats.
Legendary enemies can be easily identified with the obvious "Legendary" prefix and a star beside their name. They will always carry a Legendary type weapon or equipment upon death, which makes them worthwhile to fight and kill. Since their appearance is random, it's always a good idea to kill and loot a legendary unless you're too weak to fight it.