The infinitive (to + V) and gerund (V-ing) can both be the object or complement of a verb, but they each have preferred usages.
The infinitive is preferred for anything expected in the future, a one time event, and personal intention or preference.
The gerund is used for events that already happened, regularly happening or being repeated, or common routines.
Examples:
1 He forgot to stop by the bank: future (relative to the time of forgetting).
2 He is scheduled to leave: future, one time event.
3 I want to go: personal intention, specific one time action.
4 I like to help other people: personal preference, viewed as a future plan.
5 He started to work on the task: "to" implies starting one specific thing.
1 He remembered meeting her: past event (relative to the remembering).
2 He finished taping the show: past action.
3 He didn't mind sitting in the back: common action of sitting.
4 I like helping other people: personal preference, viewed as a routine.
5 He started throwing things in the room: V-ing implies repeating it many times.
So some verbs prefer one or the other (want, intend, choose, finish), some can work with both (like, agree, start) with largely the same meaning, and some have different meaning depending on which one is used (forget, stop).