Some verbs take infinitive objects and gerund objects. Some verbs only take one or the other.
Ex: I like to study math. (infinitive object)
Ex: I like studying math. (gerund object)
Your grammar book should have several pages of explanation and lists of verbs that take both, take an infinitive object, or a gerund object.