"I like taking off my pants."
Translation:저는 바지를 벗는 것이 좋아요.
것이 if the noun is the subject of the verb. 좋다 means "to be good" (Remember: Korean doesn't really adjectives the way English does, just "descriptive verbs"). "Taking of my pants" is what is "good" and therefore needs the subject marker.
것은 if the noun is what the sentence is about (the topic), even if it isn't being affected by the verb in the sentence. The topic markers 은/는 often have a small nuance of comparison. Sort of meaning, "as for this thing" or "unlike other things"...
것을 if the noun is the object of the verb (it is receiving the action). This will only really be used with action verbs like 좋아하다 instead of a descriptive verb like 좋다.
Effectively the following two sentences are indentical in meaning, but phrased differently: 저는 바지를 벗는 것이 좋아요. 저는 바지를 벗는 것을 좋아해요.
An example of using 것은 when making a strict comparison would be: 제 바지를 벗는 것은 밖에 나가는 것보다 더 좋아요. (I like taking off my pants more than going outside.)