The immune system is incredibly efficient and well designed to recognize foreign invaders and kill them. This is how it protects us against infection.
However, as cancer cells have evolved, with the ability to hide and trick the immune system in order to survive, the immune system has trouble eliminating them.