Gerunds are verbs ending in -ing that function as nouns, like "swimming is fun." Infinitives are the base form of a verb with "to" in front, like "to swim." Both can be subjects, objects, or complements. Use a gerund after prepositions or as the subject of a sentence, and an infinitive after certain verbs or as noun complements. With some verbs, you can use either.