People usually think of competitive swimming as just training hard and racing in competitions. What is not really recognised, but is a big part of swimming fast, is the period before the competition. It is called "taper", and it is the process of resting the body and fine-tuning the small things to get the body feeling sharp, snappy and ready to swim well.
The taper process is different for every swimmer. It is dependent on a myriad of things, such as the event and distance they swim, age, gender, what kind of work they put in before the meet and how much rest they need. Some swimmers can be in the gym until a few days before their event, whereas others would stop two weeks before.