As the startx man page says,
startx - initialize an X session
The startx script is a front end to xinit that provides a somewhat
nicer user interface for running
a single session of the X Window System. It is often run with
X command runs the X server.
startx does that and also initializes the session, i.e. runs what is specified in the configuration files, typically the windowing environment, xterm etc.
To determine the client to run, startx first looks for a file called
.xinitrc in the user’s home
directory. If that is not found, it uses the file xinitrc in the
xinit library directory.
To illuminate further, startx uses these files:
$(HOME)/.xinitrc Client to run. Typically a shell script which runs many programs in the
$(HOME)/.xserverrc Server to run. The default is X.
Client to run if the user has no .xinitrc file.
Server to run if the user has no .xserverrc file.