White blood cells help to recognize when a foreign and potentially harmful pathogen enters the body, and they respond by releasing antibodies, such as lymphocytes and phagocytes, which attach to the pathogen and work to eradicate it. A high amount of white blood cells are found in the lymph nodes, which is why a symptom or sign of infection in the body can be evident by swollen lymph nodes.
Depending on the nature of the pathogen that enters the body, the body's white blood cells can respond in various ways to fight it.
Some cell-damaging bacteria release toxins into the body. They do so by latching onto host cells to destroy them. This negative process can be accomplish by the bacteria either consuming the host cell's nutrients, releasing toxins into the cell, simply destroying the structure of the cell or causing the body to have a hypersensitive reaction. White blood cells can release anti-toxins to counteract the effects of this bad bacteria.
A particular type of white blood cell, referred to as a phagocyte, is responsible for consuming the pathogens found in the body. They can also consume and digest pathogens that have been destroyed by other white blood cells.
Lymphocytes release antibodies that help to either destroy pathogens or make it easier for the phagocyte to do its job in digesting the pathogen.