Companion planting is the planting of different crops in proximity (in gardening and agriculture), on the theory that they assist each other in nutrient uptake, pest control, pollination, and other factors necessary to increasing crop productivity.
Companion planting is used by farmers and gardeners in both industrialized and developing countries for many reasons. Many of the modern principles of companion planting were present many centuries ago in cottage gardens in England and home gardens in Asia.
Here is the list of good and bad companion crops for tomatoes
Carrots work well with tomatoes because they share space well. The carrots can be planted when the tomatoes are still quite small, and can be happily growing and ready to harvest by the time the tomato plants start to take over the space.
Chives, Onions, and Garlic:
Members of the onion family are beneficial to plant with many types of crops due to the pungent odor they emit. This helps deter many insect pests.
Borage helps deter tomato hornworm.
Asparagus and tomatoes are good neighbors. Asparagus puts on growth very early in the season, and the tomato plants fill in after asparagus has been harvested. Also, tomatoes help repel asparagus beetle.
Marigolds help deter harmful nematodes from attacking tomatoes. The pungent odor can also help confuse other insect pests. To deter nematodes, the best practice is to grow the marigolds, then chop and till them into the soil at the end of the season.
Nasturtiums help deter whitefly and aphids.
Growing tomatoes and basil together increases the vigor and flavor of both crops.
Spinach, Lettuce, Arugula:
These are also "good neighbor" crops for tomatoes. They stay fairly small, and will grow better in the heat of summer when shaded by the growing tomato plants.
What Not to Plant with Tomatoes:
The following crops should not be planted with tomatoes:
Brassicas: Tomatoes and all members of the brassicas family repel each other and will exhibit poor growth when planted together.
Corn: Tomato fruit worm and corn ear worm are nearly identical, and planting these two crops together increases the possibility that you will attract one (or both) of these pests.
Fennel: Fennel inhibits the growth of tomatoes.
Kohlrabi: Kohlrabi inhibits the growth of tomatoes.
Potatoes: Planting tomatoes and potatoes together makes potatoes more susceptible to potato blight.