Mutations occur in our DNA all the time. Some lead to positive developments (evolution), some mutations are harmless (neutral/benign), some are repaired before they replicate, but some - a small amount - those within our stem cells (or cells with stem cell like properties) that are not repaired can go on to cause cancer. While only harmful mutations within stem cells lead to cancer, the process of all mutations are the same.
Mutations are the result of a physical change to the base pairs that encode for the amino acids in our DNA, that then leads to an error while our DNA is being copied. The physical damage to our DNA can be caused by many different things, but it's usually some form of radiation (the sun), oxygen radicals, chemicals in the environment around us, cosmic rays (small molecules from beyond our atmosphere). Through various processes pieces of our DNA can be damaged; biomolecules can break off, merge together, get knocked out of place, etc.
Source: National Cancer Institute
Because this happens all the time, and because our DNA has a template strand, our body's are able to repair the damage and replicate. Even if the damage occurs to both DNA strands, or the original amino acid sequence (and therefore the repair instructions provided by the template strand), our bodies have a way to repair that as well.
With the help of a gene called the ‘error prone pathway’ a replacement pair of amino acids will be inserted in place of the missing or damaged acids. These amino acids are a placeholder, a band aid of sorts, they are not the correct amino acids but they fill the gap in our DNA. If the cell is able to replicate with this band aid, the replicated cells are classified as a mutation.