When a pathogen invades the body, antigen-presenting cells (APCs) capture and process the pathogen's antigens. These APCs then present the antigens to T cells, activating them. Once activated, T cells proliferate and differentiate into their respective types to combat the infection. Cytotoxic T cells target and destroy infected cells, while helper T cells release signals that enhance the activity of other immune cells.