I was thinking the same thing at first until I got to use them, and then I saw how effective they are. In a melee attack you will always take damage.
With a range of 1, MG's have to be moved right the the adjacent hex, just like melee. But then you can attack the enemy and take zero damage. And unlike the earlier ranged units who have a range of 2, the MG and gatling gun are just as effective at defending as they are at attacking, except they do take damage when defending. But they are still very capable at defense nonetheless.
MG's are good for softening up your enemy while taking minimal damage yourself. Also, they are very good for attacking cities. If you have several MG's they can attack for several turns in a row with minimal damage, then when the city is weak enough you bring in a melee unit to capture it.