Many plants have natural substances in their roots, flowers, leaves etc. that can alternately repel (anti-feedants) and/or attract insects depending on your needs.
In some situations they can also help enhance the growth rate and flavor of other varieties.
Experience shows us that using companion planting through out the landscape is an important part of integrated pest management. In essence companion planting helps bring a balanced eco-system to your landscape, allowing nature to do its' job.
... to be completed
search for "Companion Planting" for explanation,
& see these companion tables for reference >>
InfoGraphic from goodtobehome