Any substance, generally a protein, that stimulates the immune system and elicits an immune response. Recognition by the immune system elicits either a T-lymphocyte response, recognizing processed antigens, or a B-lymphocyte response, producing antibodies that bind to unprocessed antigens.