> A vaccine is a biological preparation that provides active acquired immunity to a particular infectious or malignant disease.
With viruses and bacteria the immune system eventually catches up and vaccinating tends to be done before the host is infected (rabies vaccination is an outlier since it still works even after infection during the latent period). With cancer the immune system usually doesn’t recognize the threat which is why vaccinating after the fact is still effective.
The definition is broader than that. Think of a vaccine as something which teaches your immune system to fight some particular thing.
The most common application is as a preventative measure to protect you from an infectious disease. But it can be used for other diseases (like cancer, which is not infectious) and it can be used after you're sick.
Fun fact: if an unvaccinated person is exposed to measles, they can get the MMR within 72 hours of exposure, and it will still reduce the severity of the disease. (Source: https://www.cdc.gov/vaccines/vpd/mmr/public/index.html )
Because the definition of vaccine has been muddled with what used to be called gene therapy. In this case, they are tricking the body's immune system to attack specific cancer cells like it would learn to attack a flu virus or any other antigen.