Can someone explain why we need の in this sentence?
The "が好きです" structure needs a noun before it, not a verb.
The の particle here acts as something called a nominalizer - it makes the part of the sentence that comes before it a noun. So, スポーツをする - the action of playing sports - is made into a noun and the sentence means: "playing sports is liked (by me)".
You could simply say "スポーツが好きです" (I like sports) but it wouldn't mean quite the same thing as the phrase above.
のが or のは is used in this context to make the doing of a verb the topic of the sentence. It comes up frequently in the course.
Anytime it describes doing a verb (I like doing X, I hate doing X, It's hard to do X, It's easy to do X, It's fun to do X, It's boring to do X) のが or のは will follow said verb to indicate that you aren't finished with the sentence yet and the verb is the subject or topic.
If you didn't include it you would essentially be saying, for example, "I play sports. I like." without the のが. With it you are saying "Playing sports is something I like to do."