Your body adapts to the increased demands on in by a number of biological changes depending on the specific demands.
This is generally known as the SAID principal: Specific Adaptations to Increased Demands.
When you initially start any sort of fitness routine, your muscles will grow to adapt to that training. I’ll cover that more below in the resistance training section. When you run, your leg muscles will grow a little bit to adapt to the new stresses you’re putting on them. When you swim, your upper body will adapt.