It's usually a gerund, serving as subject of the sentence, or fronting a gerund[ive] phrase, which in turn serves as subject of the sentence. Swimming is fun. Swimming in the river is dangerous.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.