When a foreign invader (like a virus or bacteria) enters the body, the immune system identifies it as "non-self" and initiates a multi-layered defense: Immunity Types | Vaccines & Immunizations - CDC
Active immunity is the protection your body develops when its own immune system produces antibodies and specialized cells to fight a specific pathogen. Unlike passive immunity, which provides temporary "borrowed" protection, active immunity is generally long-lasting—sometimes even lifelong—because it creates . How Active Immunity Works active immunity