If your installation of Ubuntu is not fresh (an old version that you updated since then), this solution might be exactly what you need to permanently fix this bug.
First, check the list of installed input drivers with this :
apt list -i | grep xorg-input
If you see xserver-xorg-input-synaptics
and xserver-xorg-input-libinput
, good news ! Just uninstall the synaptics package like this :
sudo apt remove xserver-xorg-input-synaptics
The reason is simple : this package is obsolete.
Now restart the xorg server (logging out and then back in will do) and the problem should be fixed ! If it is not, try toggling the "Natural Scrolling" setting in the "Mouse & Touchpad" page of Gnome Settings.