Here, this is a bit different from stopping programs in MacOS from running automatically as shown here. https://techdirectarchive.com/2019/01/15/how-to-stop-a-program-from-starting-up-automatically-on-macos/
Here i am running TeamViewer 14.1.3399 as at the time of this writing. Here is the steps to disable TeamViewer from running automatically upon System startup or restart.
Launch TeamViewer Under Unattended Access Uncheck 'Start TeamViewer with System'
Next, a pop up windows appears, where you are asked to disable start with system. After this step is performed, TeamViewer will restart itself.