The Gym is a location found in the city where Little Mac can be unlocked as a fighter in World of Light. Once you have unlocked the Master Spirit that is located right in front of the Gym building, it can be used at any time by either going to the house where the training is housed or through the Activities tab in the Pause menu.
The Gym has four slots for up to four primary spirits. Selecting a slot will allow you to select what spirit you put there. Spirits in the Gym cannot be used for anything, but can be removed from the Gym at any time. After being removed, however, they cannot be put back in there or go on an Explore expedition as they are exhausted and need to rest for a while before they can be used again.
While spirits are within the Gym, they will constantly gain EXP, making it a reliable way to level up your low-level spirits while you're off adventuring and give them a bit of a kick-start. This service does not cost Spirit Points, and Spirits can be in there for an unlimited amount of time until they are maxed out. However, the EXP buildup is slow and thus becomes unreliable once the spirit reaches a high level. The EXP spirits gain over time depends on their rank. This means a Novice spirit will likely be maxed out if left in the Gym overnight, while Legends would take well over a full day. This makes it better to use Snacks on high rank spirits, where the SP cost of using the snacks added to the fact that you're consuming non-too-common items is worth the time it saves.