When playing as Heavy in TF2 and using the minigun, should I be going for body shots or head shots? Does the distance matter?
The minigun does constant damage regardless of location hit. In fact, most weapons work this way. The notable exceptions are most sniper primary-slot weapons and the Spy's Ambassador - these weapons can deal additional damage if you hit your enemy's head.
The damage dealt depends on the range - the further the range, the less damage per bullet that hits. This wiki page gives the damage per shot as 50-54 at point blank, versus 5-10 at long range. (The definition of the various ranges is given on the page, in terms of "real" map distances.)
There's also the concept of bullet spread, which means that at longer ranges less of your shots will be within the "crosshair" of the minigun. It's a bit harder to find sources to quantify this effect, but the hitscan article contains at least a partial description.
The conclusion that you should draw from this (as Kevin correctly points out in the comments) is that you should be pointing at your target's center if you want more of your shots to land. Aiming at the head simply limits the number of bullets that land, and gives you no additional damage to offset this.