There's not a whole lot of hard science backing up most companion planting suggestions — they're based mainly on folklore and the educated guesses of experienced gardeners. Perhaps one of these days a lot of this advice will be scientifically explained and proven, but some of it is already withering under the glare of careful observation.
Many of the companion lists suggest that marigolds repel some garden pests, particularly cabbage worms and Mexican bean beetles. Research, however, shows that marigolds actually attract cabbage butterflies, which lay eggs that hatch into cabbage worms. Furthermore, though it does appear that marigolds protect beans against Mexican bean beetles and corn earworms, it seems they also exude chemicals harmful to bean plants.
While on the subject of marigolds, we should examine the oft-made assertion that they should be planted among tomatoes to repel certain pernicious root nematodes. It's not all that simple. Root nematodes bothersome to tomatoes are discouraged only by certain French marigolds (Nemagold and Queen Sophia, for example), and only when the entire infested area is planted with marigolds for a whole season. Simply planting a few common marigolds in among the tomatoes will not do the trick.