Any animal has a seemingly boundless amount of lines of genetic code in its body, and with more pieces come a greater possibility for error. Here's an example: I'd venture to guess that most people on here have had cancer at one point in their life (if not right now), but the cancers were small enough that the immune system took care of them without any ill repercussions.
Evolution happens through mutation. When a mutation gives an individual an advantage the others don't have, it is more likely to reproduce, thus giving it a better chance to pass its ("mutated") genes on to the next generation.