것 (thing) is used as a dummy noun/filler to “nounify” a verb or an entire expression. It is like the usage of “that thing” in English: I like that thing that you do. If you want to be extremely literal about it, this example would be “to me, the skirt-wearing thing is good.” The “thing” would refer to the act of wearing a skirt.
- 치마를 입다 is to wear a skirt.
- 치마를 입는 것 is the act of wearing a skirt.
- 치마를 입는 것이 좋다 is to like the act of wearing a skirt.
Obviously, English has some linguistic shortcuts for constructions like these and so “to me, the act of wearing skirts is good” becomes “I like wearing skirts.”
Because 좋아하다 is 'to like' and is used with objects, and 좋다 is litterally 'to be good' and is used with a subject. 게 is short for 것이 (subject particle) and therefore 좋다 is used. You could say '저는 치마를 입는 것을 좋아해요' and it would be fine too, but the other type of structure is common to say you like something, and would literally mean something like 'For me, wearing a skirt is good/enjoyable'