Both are grammatically correct. Among other details, the nuance here is that は emphasizes what comes after it: 嫌い. If が is used, it'd emphasize the subject/topic: 病院に行くの.
は: "I hate going to the hospital." versus が: "Going to the hospital [is a thing] I hate."
So using の here after the plain form of a verb changes a verb into a noun, like gerunds in English? So in the sentence, 'I like running', 'running' becomes a noun. Likewise, 走るが好きです means 'I like to run', but 走るのが好きです means 'I like running'?
Sort of yes. の is used to create noun phrases. So "走るの" is something like "the act of running". But you have to use this if you want to say you like to run or that you like running. "走るが好き" is grammatically incorrect, it has to be "走るのが好き".