Garlic is neither a stem nor a root; it's a bulb. It's part of the allium family, which includes onions and shallots. Bulbs are modified underground stems, formed by the overlapping of many nodes in the condensed stem.
While garlic does have roots, they're not the edible part. The bulb, which we eat, is the modified stem containing cloves, each of which is a bud capable of producing a new plant.
The confusion about garlic being a stem or root stems from the fact that it grows underground. However, unlike roots that absorb water and minerals, the bulb stores nutrients and energy for the plant.
Additionally, garlic is often referred to as having a "stem" and "root" when discussing the parts that are trimmed off before cooking. This terminology refers to the stalk connecting the bulb to the leaves and the root system anchoring the plant in the soil, respectively.
Therefore, the next time you think about garlic, remember it's a bulb, a modified stem, not a root!