The incidence and duration of my colds andf flus decreased dramatically after I started running year round many years ago. I attributed that the increased blood flow and breathing during running. One pet theory is that because running elevates body temperature a degree or two, it acts like a pseudo-fever in speeding recovery.
Two caveats: First, if one ramps up to ten mile runs in just a few weeks and months, they might be stressing the body. It takes a years to get fully used to long distance running. Second, gyms are notorious place to catch germs with people in close sweaty proximity and touching common surfaces. You have to be careful about not touching your face and washing hands.