Genetic changes in cancer can occur due to a variety of factors, including exposure to carcinogens like tobacco smoke, ultraviolet radiation, or certain chemicals. Additionally, some genetic changes can be inherited or occur due to errors in DNA replication. Environmental factors and lifestyle choices also play a significant role in the accumulation of these genetic alterations.