How to theme the user profile page? What is the file I have to modify in order to get Drupal to output a custom user page.

The default link to the file I need to change is:

http://www.example.com/?q=user/xx


Where xx is the user id.

This page is not dysplaying correctly and I want to fix it, but how do I know which file is Drupal calling?

Is there a reference guide on Drupal 7 default pages and links?
Here is a brief list of template suggestions for Drupal 7: http://drupal.org/node/1089656

If you are looking to theme the user page, there are multiple templates located in modules/user that can be overridden. The template you should probably start with is user-profile.tpl.php.  Copy that file and paste it in your theme directory then edit it as you like and clear the cache and you should see the changes.