As I understand it, the wrong combination of tumor suppressant/promoter genes getting switched off/on gives you cancer.
Exposure to some things can cause more mutations or hinder your body's error-correction systems, sometimes to extreme degrees. It is a numbers game, though.