Physician used to "blood let", they went by a theory of different "humours' that controlled the body. Leeches were used to draw out the bad blood and with it the ailment. Some places still use it today, also Maggot therapy. Using maggots to eat away necrosis tissue.
leeches were used based on the belief of "the four humors", aka humorism, the belief that the body runs on four "humors", or body fluids. one of them was blood. the others were yellow bile, mucus/snot, and black bile. doctors of the 1600s believed that illnesses were caused by an imbalance of the fluids in your body, so they'd use leeches as a form of bloodletting, in oredr to "balance" the humors.