Did you try simply restarting the Mac? This may be caused due to damaged track pad.
The most common reason this happens is because "Ignore accidental trackpad input" is enabled. So please check if "Ignore accidental trackpad input" is enabled. This function disables your trackpad to prevent accidental inputs. To disable it, locate to accessibilities or press on the option key for 5 times
Try to enter to recovery mode and run diagnostic test to see wether there are any problems with your Mac.
Also, try updating your Mac to the newest version.
If you can't find out anything, please take your Mac to apple support.
To use your Mac normally (if you have no plans to fix your Mac, or have a tight schedule), try using the "head pointer" function (controls the pointer with your head) or connect to a bluetooth mouse.
If none of them actually worked, also try backing up your hard disk and reset your Mac. (Maybe erasing the whole disk and reinstalling the OS)
Thank you for reaching out at Apple Community