A Beneficial weed is any of various plants not generally considered domesticated, but which nonetheless has some companion plant effect, or else is edible or somehow beneficial. Beneficial weeds include a great many wildflowers, as well as many weeds that are commonly removed or poisoned.
Companion benefits
Many beneficial weeds attract parasitic insects away from other crops, sometimes even poisoning those insects and thus ending their threat entirely. For example; several kinds of weed will be devastated by Japanese beetles while normally attacked vegetables nearby go completely ignored.
Some others:
lock nutrients into the soil
repel insects and other pests through their smell
are unpleasant to small animals, because of their spines or other features, keeping them away from an area to be protected
seem to subtly change the flavor of other plants around them, in a way humans find desirable
provide a "living mulch" effect, keeping the ground moist and healthy and preventing the growth of actually harmful weeds
grow on different levels in the same space, perhaps providing ground cover or working as a trellis for another plant
some weeds repel plants or fungi, through chemical means
Indeed, another kind of beneficial weed is any decorative wildflower that is yanked out or cut when young, so its actual identity is never recognized by the gardener or yard keeper.
Dandelion is a relatively well-known example of an edible weed.