What does Drupal do when registering a user? I'm relatively new to Drupal.
I like to understand what Drupal does programatically when a user is being created?

More specific I like to know if any file is being created?
Or is it just a database transaction?
Where is the database changed? Which tables?

Because I would like to build a 3rd internal party to create acct from 'behind' so I need to understand what it does so my 3rd party app can mimic the same and at the end the new user login seamless.
No file is being created (unless you count the user avatar), only a database row in the users table.

You should check out the user_save function in the Drupal docs.