To expand on this a bit more, when “stop” is followed by an infinitive, this is just the simple meaning that you probably already understand.
When we use a gerund (stop + ing verb), this is like saying what you are stopping to do.
I stopped to eat =
I stopped doing something so that I could eat
I stopped doing something in order to eat