What does the GO statement do in SQL Server?
GO is not a part of the TSQL language.  It's a batch separator used by SQLCMD and SSMS.

GO is not a Transact-SQL statement; it is a command recognized by the
sqlcmd and osql utilities and SQL Server Management Studio Code
editor.
SQL Server utilities interpret GO as a signal that they should send
the current batch of Transact-SQL statements to an instance of SQL
Server. The current batch of statements is composed of all statements
entered since the last GO, or since the start of the ad hoc session or
script if this is the first GO.
A Transact-SQL statement cannot occupy the same line as a GO command.
However, the line can contain comments.

SQL Server Utilities Statements - GO
It originated with the command line interfaces, and persists in sqlcmd to this day.  You can write a batch over multiple lines in the command line interface, and the batch isn't sent to the server until you type go.
1&gt; select name, create_date
2&gt; from sys.objects
3&gt; where name = 'foo'
4&gt; go
name                                                                                                                             create_date
-------------------------------------------------------------------------------------------------------------------------------- -----------------------
foo                                                                                                                              2020-07-20 09:56:42.393

(1 rows affected)
1&gt;

You can configure what to use for a batch separator in SSMS. GO is the default, but it can be just about anything else.