The thing about this kind of 'just so' story causal mechanism is that we still have to actually do the science to find out. Your body does filter and kill potentially cancerous cells all the time already. And cancer cells aren't like, some super thing that evolved to kill you specifically. My just-so story goes like this: 'the cancer cells die because they're suddenly outside of the specific bodypart that they were exploiting'. And we're probably both right, depending on the location of the cancer, the type of cancer, etc.
All life, from humans to cells to chromosomes, has only one purpose - to survive. It turns out that reproduction is an effective way to survive. Also, cooperation is an effective way to survive. The cells in our bodies cooperate for survival. Sometimes cells survive better by no longer cooperating, and reproducing as fast as possible. This winds up killing the host, but the cancer cells don't know that.
And so humans evolve to enforce better cooperation among the cells.
So, no, cancer cells did not evolve to kill you. They do evolve for short term gain, however.
It's an endless struggle.
It's not unlike the struggle between civilized people and criminals.