If a person has an exercise regimen, and they want to continue it on Shabbat?
The tractate in Shabbat page קמז says אין מתעמלין, which literally means not allowed. However, there is a disagreement between Rashi and Rambam on how we define this concept. Rashi says that the definition of exercising mentioned in the Mishna is someone rubbing oil on their arm vigorously. The Shulchan Aruch follows this opinion in סימן שכז סעיף ב. The explanation for this prohibition is that it is considered a weekday activity (עובדין דחול).
Based on this reason, a healthy person is allowed to do this activity on Shabbat since it is a delight for them, and not a remedy for an illness. Since it is a Mitzva because it brings them pleasure, it takes priority over the prohibition of עובדין דחול (see סימן ש"ו סעיף ז').
On the other hand, the Rambam explains the prohibition of exercising differently. He explains that when a person is tiring the body in order to sweat, that is the definition of אין מתעמלין, and it is forbidden because it is considered medicine (medicine on Shabbat is forbidden to take to an extent out of concern that people would grind the herbs, and grinding is one of the 39 מלאכות). The Shulchan Aruch follows the opinion of the Rambam in סימן שכ"ח סעיף מב.
It appears to be a contradiction, because in סימן שכ"ח, it says that the prohibition of exercising is because of sweating. This implies that if he is not exercising for the sake of sweating, it is permissible. Whereas, in סימן שכ"ז, he follows Rashi that it is forbidden to rub the arms vigorously with oil, and that applies even without sweating. This question was also asked by the Be'ur Halacha, and his conclusion is to follow the Rambam who says that the prohibition is only if the person is sweating, and not to follow Rashi. He says that the Rambam's opinion was also found in רבינו חננאל.
If we look in the Mishna Brurah, סעיף קל, we will see a profound distinction between a situation where there is a concern that a person will accidentally grind herbs, and a situation where there is no concern. In the old days, a person would get medicine in order to sweat. This medicine was made from ground herbs. Therefore, if is one is exercising in order just to sweat, it’s as if they are grinding herbs in order to take as a medication, so they can sweat. Therefore because of this similarity, we are not allowed to exercise on Shabbat just to cause ourselves to sweat.
However, in a situation where there is no connection between the act of exercising and grinding herbs, the Mishna Berurah says that there is no concern. If a person exercises with the goal to be fit and not just to sweat, it is permissible (see רמ"א at the end of סימן של"ו that says that a person is allowed to climb up and down).
The Mishna Berurah סימן שא סעיף קטן ז also says that one is not allowed to run in order to warm up out of concern that it is like an act medicine that may lead him to grinds herbs. The Mishnah Berurah there is referring to a particular case when one is warming up to just to sweat since sweating is an act of medicine. However, if a person is exercising in order to be fit, and not to sweat, it is permissible.
This is also the psak of אור לציון (ח"ה ס"ק) that says a person is allowed to run to be in good shape, because running per say is permissible. Just as the Shulchan Aruch says in סימן שא, people that enjoy walking, jumping and running on Shabbat are permitted to do so. Likewise, a person is allowed to be massaged if it is not being done by a professional and if it is being done gently. This is also the opinion of הגרש"ז אורבך in his book שמירת שבת כהלכתה (פט"ז צ'ט) ובנשמת אברהם (חלק ה' ס"ק ו)).
On the other hand, שו"ת מלמד להועיל חלק א' סימן נג says that only if you are running or jumping for fun, but if the running per say is not for delight but for physical benefit in the future, it is forbidden. Just as the Shulchan Aruch in סימן שכ"ח but שו"ת מלמד להועיל concludes in his response, we cannot rebuke those who are accustomed to being lenient.