This is a huge question. Brace yourselves for a huge answer! Seems likes every week there is some new food or activity that is supposed to prevent cancer (Acai berry! Pomegranate juice! Low fat diet! Soy! Organic produce! Vegetarianism! Whatever!) I have now spent almost five years in graduate school studying breast cancer, and attending many, many seminars, lectures, and meetings about other types of cancer. I will try to boil down the real, true stuff for you into some basic facts.
First, what is cancer? Cancer is the uncontrolled growth of your own cells. Cancer can originate almost anywhere in the body. The most common types of cancer in the U.S. are lung, breast, prostate, skin, liver, blood (leukemia), and brain. We get cancer because cells become damaged, start to grow uncontrollably, and eventually spread around the body (metastasize).
Aside from that, our family history (genetics) plays a big part in whether or not we get cancer. Brca1/Brca2 mutations cause familial breast cancer, Retinoblastoma is caused by a mutation in the retinoblastoma protein, and many, many other cancers have a genetic component. If your parents, grandparents, aunts, uncles, or siblings had a particular type of cancer, your risk goes up. It is an unchangeable genetic predisposition.
Also, there are environmental causes of cancer. Smoking dramatically increases your risk for lung, esophageal, and bladder cancer, and also increases the risk of almost every other type of cancer there is. Sun exposure increases your risk for skin cancer. Lung cancer can be caused by asbestos or radon gas exposure. Being overweight also increases your risk for cancer across the board - especially breast cancer. Living in a very polluted city, or drinking water with lots of pesticides or contaminants can increase your risk.
Some habits and foods can decrease our risk for getting cancer. Fruits, vegetables, berries, and other produce contain antioxidants, which neutralize ROS and therefore reduces DNA damage. Exercising keeps your body healthy, immune system humming, and reduces the risk of cancer. Wearing sunscreen protects from premature aging and skin cancer. Keeping a healthy weight is important too. And, for goodness sakes, don't smoke. Get screened for cancer according to the recommendations of the NCI and your doctor. About 1/3 of Americans will get cancer in their lifetime. About 1/4 of them will die from it. It is worth thinking about, and should spur us to have good habits. However, remember the biggest risk factors are 1) getting old, 2) breathing, 3) living on planet Earth, and 4) family history. For some people that makes them feel hopeless. I have come to accept cancer as a reality of the human condition, which we can tweak slightly with our habits and hopefully cure one day through science.