The adaptive immune system can evolve at microbial speed via somatic hypermutation (SHM). As a learning process, SHM diversifies the recognition receptors used by lymphocytes to recognize foreign elements (antigens), thus allowing adaptive response to new threats. Antigens are usually proteins or polysaccharides.
This learning process is encoded in antibody genes. These genes can rearrange themselves to form a vast array of antibodies: well over 100 million distinct types.
SHM affects only immune cells. Somatic mutation is different than germline mutation. Somatic mutations are essentially disease memory, typically not passed on to offspring. In contrast, germline mutations are part of the heredity system that provides adaptations from one generation to the next.