An infinitive is another kind of verbal that functions like a noun in a sentence. It can be the subject (but this is not very common) or the direct object (after certain verbs only!). However, the infinitive is never the object of a preposition. Only a gerund can follow a preposition.
Infinitive as subject: To remember all these grammar rules is not easy.
Infinitive as direct object: I want to remember the rules.
Infinitives and infinitive phrases can also express reason or purpose (why someone does something).
Infinitive of purpose: I am taking this course to improve my English.
Watch Paul's short explanation about infinitives: