Living cells constantly attempt to repair "the inaccuracies" occurring over the course of life of a cell. Reaching a beyond repair stage leads to apoptosis, or genetically programmed cell death; in other news, the cell commits suicide.
A cell turns into a cancerous cell when some of the oncogenes (namely, p53 and, likely, p16) responsible for upregulating apoptosis become silenced, and the cell continues to live in a dysfunctional state as a cancerous cell. We do not know yet what excatly causes the gene silencing.
At any point in life, the human body contains a number of cancerous cells that it methodically gets rid of or neutralises, which is a normal process of life. Not every cancerous cell turns into a tumor and leads to cancer We do not know yet what causes it. Many people die of an old age and do not have cancer.
I forgot the actual source link, but I remember seeing a publication showing how autopsies on young people who died of accidental circumstances showed tiny cancer tumors in their bodies even in their 20s-30s, and that simply these would not grow further because of the repair mechanisms being highly effective in younger organisms.
So basically you get mutations in your body the whole time. Not just when you age.