It plays an important role in the immune system by attacking virus-infected cells , foreign cells , and cancer cells . The `` T '' in T cell stands for thymus . Memory T cells comprise two subtypes : central memory T cells ( TCM cells ) and effector memory T cells ( TEM cells ) .