One traditional practice was planting of corn (maize) and pole beans together. The cornstalk would serve as a trellis for the beans to climb.
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.
Nasturtium 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.