When the browser follows a link to a file with a certain extension, the browser decides how to deal with it. Often, such as when the browser doesn't know directly how to deal with a certain extension, it delegates the handling to the operating system. This is where a compression tool (WinZip for example) would pick up the handling of the item requested.
When you send data out from a web server, you can attach header information to the HTTP response that contains information to identify the type of information you are feeding the browser. So if we had an ASP.NET web form that actually emitted data that we wanted to see in Microsoft Excel, we could add a header to the HTTP response identifying the "ContentType" as "application/ms-excel". This would tell the browser how to handle the data, even though the URL may look like it's a regular web page. (In fact, pages with the aspx extension are sent to the browser with the content type of "text/html". Otherwise the browser wouldn't know to display it as HTML.)
In .Net code, you would do this something like this:
Response.ContentType = "application/ms-excel"
Google "http content type" for more details and various lists of content types.