$_SERVER[HTTP_HOST] is derived from the incoming HTTP request.But $_SERVER[SERVER_NAME] is the predefined name of the server in the configuration file.Generally this is the name of the server under which a PHP script is being executed. Also $_SERVER[HTTP_HOST] refers to the headers from the current request, if any. Hope this helps you.
$_SERVER['SERVER_NAME'] is based on your web servers' config file (Apache2 in my case), and varies depending on a few directives: (1) VirtualHost, (2) ServerName, (3) UseCanonicalName, etc. $_SERVER['HTTP_HOST'] is based on the request from the client.