Cancer is caused by changes (mutations) to the DNA within cells. The DNA inside a cell is packaged into a large number of individual genes, each of which contains a set of instructions telling the cell what functions to perform, as well as how to grow and divide. Errors in the instructions can cause the cell to stop its normal function and may allow a cell to become cancerous.
Gene mutations can occur for several reasons, for instance:
Gene mutations occur frequently during normal cell growth. However, cells contain a mechanism that recognizes when a mistake occurs and repairs the mistake. Occasionally, a mistake is missed. This could cause a cell to become cancerous.
https://www.cancer.org/cancer/cancer-causes/general-info/does-this-cause-cancer.html
http://www.mayoclinic.org/diseases-conditions/cancer/basics/causes/con-20032378