The name Gruber is a moderately popular surname in Germany and the most common surname in Austria. It is, in one way or another, derived from the root “Grub-”, which refers to things related to digging and in general holes in the ground.
Many sources derive the surname primarily from Grub, a place name common in southern Germany and Austria. To refer to someone from a certain place in German, one can simply add the suffix -er to the name of the place, so, for example, a person from Köln is a Kölner. A person from a place called Grub would be referred to as Gruber.
I looked for some supporting evidence for this theory, and the most convincing argument is the distribution of the surname in Germany. Take a look at the following map, showing the relative frequency of the name Gruber per region (it is based on a phone directory from 2005):
Compare it with the map below, showing all places named Grub (mostly parts of towns and cities) in Germany and Austria (at least those described here):
I believe the correlation is rather obvious. Unfortunately, I wasn’t able to find a similarly detailed map for Austria. The only map I found showing the relative distribution of the name Gruber in Austria is the following one:
The sample size is not very large (it says it is based on 9645 Grubers, while the real number of Grubers is close to 100,000), but it seems to support the hypothesis that the name is more common in the regions of Austria that contain places named Grub.
Another possible explanation of the origin is that it comes from Grube, a German word meaning a pit or a depression, usually an artificial one, such as that of a surface mine. People who lived or worked in such places could have been referred to as Gruber, even when the place itself did not have any official name related to “Grub” or “Grube”. Such an explanation does not sound unlikely, but it is impossible to estimate the number of Grubers whose name originates from an unnamed “Grube”.
Finally, some sources claim that Gruber may come from the name of a profession that existed in wine regions, referring to a person who dug grooves in the ground for vine saplings (the English word “groove”, in the sense of a furrow, is related to the German word “Grube”). If this is the case, it seems plausible that the name should be more common in traditional wine regions, which are located thus (source):
However, the map above does not correlate very well with the distribution of the name Gruber (and I wasn’t even able to find a reliable source confirming that a profession with such a name actually existed), so I find the explanation unlikely and, if true, probably applying only to a very small minority of Grubers.