basically, goblins have more attack than defense, so you want them to attack and try not to be attacked (i.e. if you can, use another higher defense unit to get the only retaliation an enemy unit gets, then use the goblins, although I don't see a 'wait' command in HoMM1, maybe I missed it, or it was introduced later in the series).
As an exception to the last post's general rule, sometimes you don't want to attack, for example, you may want to position a unit next to an enemy's ranged unit without attacking it, just position it there so the ranged unit has to use its much weaker melee attack (and sometimes you can position a unit, like a gargoyle, next to 2 or more ranged enemy units, forcing them all to attack your gargoyle)