Gegen in general means a direction (like towards), while an strongly indicates a contact/touch.
An example for this general meaning is:
Die Fenster gehen gegen Osten
In your special case there would be no knocking noise in case you stopped earlier, so it is pretty clear, that gegen here also includes contact (like against).
This is confirmed by DWDS, ...
»ans Glas klopfen« and »gegen ein Glas klopfen« can describe two different things.
The second one, which you encountered in the movie, is correct here, because in Germany people typically tap their spoon against a glass at larger gatherings to attract attention, e.g. if they want to give a short speech or if they want the wedding couple to kiss (in this case ...