Companion planting while a simple concept is not necessarily a simple thing to implement. The historical basis for this practice came about for a number of reasons. Your old granny new that if you planted borage and basil near your tomato plants that wonderful things happened. The borage helped to repel tomato hornworm and the basil seemed to impart a sweeter flavor to the fruit. If rue was planted near the same grouping then cats, squirrels and rabbits stayed away from the tomatoes but the basil seemed to suffer. This in a nutshell is companion planting. You plant things next to each other to help or hinder your food production. This also works in other ways as well. In small farming practices corn is used as a companion for pole beans and peas. The corn is fast growing but slow to mature. This makes it perfect to use as a frame to grow the faster maturing beans and peas on and legume crops plowed under after the corn has been picked can help reinvigorate your soil.
You can find some suggestions for your vegetable garden here
You can find the chart for herbs here