. which regress
And it will show you the location of the ado file. Go there and open it
with the text editor.
Manos

e.g.

viewsource regress.ado

How informative that is depends a lot on the command. Much of the
work may be done by built-in functions that you can't see. And, even
if you can see the code, it may be difficult to understand everything
that is going on.

The command

set trace on

can also be helpful, although you may get overwhelmed with output.

Depending on your purposes, Stata's ML book and/or programs may be
worth reading: