Can be the object of a preposition, for example: We are talking about swimming in English class. We discussed quitting smoking for good.
So when do we know when to use one or the other? That can difficult to define. In general, the rule to follow is:
Gerunds are used to express actions that are real, concrete and completed.
Infinitives are used to express actions that are unreal, abstract or may be in the future.