Your immune system is named after a tax break.
In Latin, immunis described a person exempt from public service or taxes. It joined in-, "not," to munis, "performing services." Behind munis stands munus, a duty performed for the community. Munus could also mean a gift or a public show. Etymonline glosses immunis as "exempt, free, not paying a share."
Cristobal Silva, writing in Keywords for Health Humanities, describes Roman immunitas as "the exemption from tribute and taxation that a sovereign power could grant." Over time the sense widened to protection from legal liability or prosecution.
English followed the legal track first. Immunity appears in the late 1300s for exemption from service or obligation, borrowed from Old French immunité and Latin immunitas. The adjective immune followed in the mid-1400s, meaning "free, exempt," for instance from taxes or tithes.
The medical meaning is a 19th-century arrival. Etymonline dates immunity as protection from infectious disease to 1879, and the medical adjective to 1881. Silva ties the shift to the new science of microbiology, including Louis Pasteur's work on anthrax and rabies. Silva argues that medicine borrowed the word by analogy with law. A body that resisted a disease was, in effect, excused from paying its dues.
The new sense spread quickly. Immune system is attested by 1917. Autoimmune, for an immune response turned against the body's own tissues, dates from 1952.
The old root has other descendants. Municipal comes from municeps, a citizen of a free town, someone who "takes on" an obligation, from munus plus capere, "to take." Etymonline also lists Germanic words for "common," such as Gothic gamains, as cousins from the same root. That root, it says, dealt with the exchange of goods, duties and obligations within a society.
So the medical word still carries its Roman logic. Immunity is a duty you have been let off.