Yes, the original sentence is grammatically correct. Here’s why:
The phrase “by pushing the end against something” explains how someone puts out a cigarette. The word “pushing” works as a gerund here to show the action.
If you change “put” to “putting” like this:
“The word ‘stub’ means putting out a cigarette by pushing the end against something,”
it changes the sentence’s structure and meaning slightly.
The original sentence is clearer and sounds more natural in formal English. Stick with it!