The immune system works in part by recognizing what is "self" and what is "not self". It also functions to destroy mutated and unhealthy cells that may be "self" but pose a threat to survival.
Cancer is "self" that has mutated and started to multiply.
An artificial heart is "not self". Immunosupressant drugs make the immune system less effective at doing its job. They suppress the immune system. That means the immune system is weakened and will not attack the artificial heart (which is "not self") but it ALSO won't attack mutated cancerous/pre-cancerous cells.
Let me know if this is still confusing, I am happy to help!
Yours in Education,