What's the difference between swimming and gym from a professional point of view?

One is aerobic exercise and the other is anaerobic exercise.

One is to enhance cardiopulmonary function and shape a good figure. One is an exercise that emphasizes muscle strength and beauty.

Swimming is competitive and practical. Fitness is not a competitive sport, bodybuilding is just to show muscles.