Getting confused with -ing and to + infinitive
There is no specific obvious rule that explains when a verb should be followed by an -ing or an infinitive form.
Be aware that practice through reading and listening is the key to improve your grammar skills in recognizing verbs that are followed by either -ing or to + infinitive.
Knowing how a language evolved through time can help you understand the way it works nowadays. Read for practising, but also for knowing.
The use of -ing forms (further divided into gerunds and present participles) and to + infinitives after a verb is not random but needs a rather deep understanding of the English language. In short, we say there is not a rule, but, if you are as curious as CleverCookie, this answer will not sate your thirst for knowledge.
-Ing forms derive from Old English, when this suffix was used to form nouns from verbs. Present Day English takes them as full verbs, with their objects and complements, but they are still traceable to their origins. Thus, according to Los (2015), the use of gerunds as we know it appears with verbs which collocate with abstract nouns. Los (2015) also classified them into stages, namely:
Stage I: Emotion, avoidance, necessity and endurance verbs (enjoy, like, love, prefer, ...).
Stage II: Negative implication (decline, help, omit, ...).
Stage III: Retrospective verbs, and proposal verbs (remember, recall, propose, suggest, ...).
And what about to + infinitive? This is also a matter of linguistic evolution. In this case to was originally a preposition which lost its meaning. So instead of involving moving towards physically, it became moving towards in time (Los, 2015). So, this is basically and very briefly explained, a verb taking an adjunct (what in Spanish we call complemento circunstancial).
So, yes, there is a reason for it and it does make sense. Check the grammar section for a straight to the point view.
Benali-Taouis, H. & López-Pérez, S. (2019). Analyzing EFL Learners’ Written Corpus for a Better Teaching and Learning of Gerund and To-infinitive Structures. Journal for Educators, Teachers and Trainers 10 (1), 84-100. https://digibug.ugr.es/handle/10481/60012
Los, B. (2015) A Historical Syntax of English. Edinburgh University Press.