To generically answer your question as described in your title, masu-stem (aka 連用形) can often "nominalize" a verb, but the resulting nouns can have unpredictable meanings, and you have to learn them individually. Please see this answer. A good rule of thumb is that you should avoid trying to nominalize a verb using 連用形 unless you know what you are doing.
To specifically answer your question about the difference between 泳ぐの and 泳ぎ, 泳ぎ tends not to refer to the abstract concept of "swimming" as a kind of sport or action. Instead, it usually refers to someone's concrete swimming ability, style, form, episode, achievement, etc. 泳ぎが好きです simply sounds unnatural to me. A normal way to say "I like swimming" is 水泳が好きです (sounds relatively formal/serious) or 泳ぐのが好きです (sounds casual). 泳ぎ is also used as a part of fixed compounds such as 平泳ぎ "breaststroke" and 背泳ぎ "backstroke".
You can use 泳ぎ like so:
- 彼女の泳ぎはとても美しい。
(彼女の水泳は美しい is very unnatural)
- 彼の泳ぎは世界に感動を与えた。
(彼の水泳は世界に感動を与えた is wrong)
- 体操選手は脂肪が少ないため、泳ぎが苦手です。
(this 泳ぎ is interchangeable with 泳ぐの or 水泳)
- 今は平泳ぎを練習しています。
(平泳ぎ is a fixed compound)
EDIT: How about other verbs? の is very consistent and straightforward:
- ✅ 私は踊るのが好きです: I like dancing (either casually at a night club or seriously as a performance).
- ✅ 私は歌うのが好きです: I like singing.
- ✅ 私は走るのが好きです: I like running/jogging.
- ✅ 私は絵を描くのが好きです: I like drawing pictures.
However masu-stems are inconsistent and tricky:
- ✅ 私は踊りが好きです: I like (watching or doing) dance (performances).
(踊り is basically a wago equivalent of ダンス.)
- 🚫 私は歌いが好きです: wrong
(although 歌い occasionally means 'singer' in compounds)
- 🚫 私は走りが好きです: wrong
(although 走り means 'running form/ability')
- ❓ 私は絵描きが好きです: I like painters (people).