Mitosis is the process of cells growing and dividing, hence replicating themselves. Cancer is simply uncontrolled cell division.
In the cell, mitosis is always tightly regulated. If the cell has errors in it (faulty DNA, for example), the regulator proteins will not allow it to divide.
In addition, there are several processes that stimulate cell growth. For example, if cells receive certain signals, then they begin to divide.
Now if either of these two processes was faulty, it would lead to uncontrolled mitosis, and cancer. For example, if the stimulant kept stimulating even when it isn't supposed to, or the regulator proteins do not regulate properly, then the cell can become cancerous.