I have read on packaging that a Gruyère appears to be around 0 g, maybe 0.4 g carbohydrates per 100g. How come it tastes sweet?
Cheese is a complex variety of chemical compounds some of which can taste sweet. I don't know the exact make up of Gruyère but according to this article there are a couple of compounds that are known to lend a sweet flavor. Including: butyric acid, Alanine, glycine, serine, threonine, ethanol, etc.
Wikipedia says that Gruyère is a "sweet" cheese so I would assume these compounds mentioned above are in higher amounts than other cheeses.