Hard water often contains calcium and magnesium ions together with bicarbonate. Heating shifts the chemistry and can favour the formation of poorly soluble calcium carbonate.
That solid sticks to hot surfaces and builds up as scale. The amount depends strongly on the local water composition; two cities can have very different kettles after the same number of uses.
Mild acids such as citric acid or vinegar can dissolve carbonate scale because acid reacts with carbonate. That is why descaling products are usually acidic.