Trying to close open port 5900 or find process that opened it
TeamViewer is a proprietary protocol not the same as VNC. However, macOS has screen sharing (VNC) built-in. Turn it off in System Preferences->Sharing->Screen Sharing: