Companion planting is one of the fundamentals of permaculture and organic farming. It is the practice of placing different crops in close proximity of each other, so they will be mutually beneficial.
One of the earliest examples of companion planting we have today is that of the Native American peoples, who planted corn and pole beans together. The cornstalk would become a trellis for the beans to climb up. With the addition of squash, they pioneered what became the Three Sisters technique.
Plants are choosen as companion plants for the functions that they can provide, which can be grouped into the following categories: dynamic accumulators, edible nitrogen fixing species, green manures, weed inhibiting plants and weed barrier plants.
Companion planting was widely touted in the 1970s as part of the organic gardening movement. It was encouraged not for pragmatic reasons like trellising, but rather with the idea that different species of plant may thrive more when close together.
The combinations of plants also make for a more varied, attractive vegetable garden. Many of the modern principles of companion planting were present many centuries ago in the cottage garden.
Nasturtiums are well-known to attract caterpillars, so planting them alongside or around vegetables such as lettuce or cabbage will protect them, as the egg-laying insects will tend to prefer the nasturtium.
The use of plants that produce copious nectar and protein-rich pollen in a vegetable garden is a good way to enhance the population of beneficial insects that control pests. Some insects in the adult form are nectar or pollen feeders, while in the larval form they are voracious predators of pest insects.