Beneficial weed
Soil health. Although erroneously assumed to compete with neighboring plants for food and moisture, some "weeds" provide the soil with nutrients, either directly or indirectly. Pest prevention. Many weeds protect nearby plants from insect pests. Some beneficial weeds repel insects and other pests through their smell, for example alliums and wormwood. Some weeds mask a companion plant's scent, or the pheromones of pest insects, as with ground ivy, as well as oregano and other mints. Some also are unpleasant to small animals and ground insects, because of their spines or other features, keeping them away from an  area to be protected. Trap crops. Some weeds act as trap crops, distracting pests away from valued plants. Insects often search for target plants by smell, and then land at random on anything green in the area of the scent. If they land on an edible "weed", they will stay there instead of going on to the intended victim. Sometimes, they actively prefer the trap crop. Host-finding disruption. Recent studies on host-plant finding have shown that flying pests are far less successful if their host-plants are surrounded by any other plant or even "decoy-plants" made of  green plastic, cardboard, or any other green material. One scientific study said that simply having clover growing nearby cut the odds of cabbage root flies hitting the right plant from 36% to 7%. Companion plants. Many plants can grow intercropped in the same space, because they exist on different levels in the same area, providing ground cover or working as a trellis for each other. This healthier style of horticulture is called forest gardening. Larger plants provide a wind break or shelter from noonday sun for more delicate plants. Green mulch. Conversely, some intercropped plants provide living mulch effect, used  by inhibiting the growth of any weeds that are actually harmful, and creating a humid, cooler microclimate around nearby plants, stabilizing soil moisture more than they consume it for themselves. Plants such as ryegrass, red clover, and white clover are examples of "weeds" that are living mulches, often welcomed in horticulture. Herbicide. Repel plants or fungi, through a chemical means known as allelopathy. Specific other plants can be bothered by a chemical emission through their roots or air, slowing their growth, preventing seed germination, or even killing them. Beneficial insects. A common companion plant benefit from many weeds is to  attract and provide habitat for beneficial insects or other organisms which benefit plants. For example, wild umbellifers attract predatory wasps and flies. The adults eat nectar, but they feed common garden pests to their offspring . Some weeds attract lady beetles or the "good" types of nematode, or provide ground cover for predatory beetles.