There are two reasons you may have a Y-DNA match with someone with a different surname. It may be that your connection is from a time before surnames were in common use. This is especially likely for groups where surnames were often not adopted until the most recent 100 to 200 years, for example, Scandinavians and Jewish populations. Another reason for surnames not to match is that there has been a surname change in genealogical times. That could be in either your match's or your own line.
The main place that you will see matches with many different surnames is the Y-12 marker matches section. The time to a common ancestor for these matches may extend beyond genealogical records and the adoption of surnames.
If you continue to match others outside your surname at the Y-37, Y-67, and Y-111 marker levels, then there is likely to have been a surname change within the genealogical time frame. Common causes for this include deliberate name changes, adoptions and illegitimacy. For those matches at a higher number of markers (Y-37, Y-67, and Y-111), contacting your matches is the best way to learn more.