Cancer occurs due to mutations in the DNA. These mutations can be caused by a variety of factors including genetic predisposition, environmental exposures, lifestyle choices, and infections. The mutations lead to the activation of oncogenes or the inactivation of tumor suppressor genes, which results in the uncontrolled cell growth.