の is a particle that marks a verb or clause as an adjective describing a proceeding hidden thing (こと|もの) that is determined by context.
Example: Watching anime is fun
アニメを見るのが楽しい
thing of watching anime in a conceptual sense, rather than a physical thing that is watching anime). アニメを見るの(こと) is also marked by が, making it the subject of the sentence.
アニメを見る (Watching anime) is marked by の, turning it into an adjective that describes a proceeding こと or もの (inferred to be こと, an abstract thing. It is inferred to be talking about the
楽しい is an adjective describing the subject as fun.