The reasons traditions give for fasting sort into a small number of arguments, and they do not sit comfortably together.
The penitential argument treats hunger as a payment, or as the outward sign of sorrow. It runs strongly through Christian and Jewish practice, where fasting attaches to atonement and to mourning, and it is the reading most exposed to the objection that it makes God someone who requires suffering.
The ascetic argument treats appetite itself as the thing to be trained. If the will can refuse food, which is the least negotiable of wants, it can refuse anything. This is the argument of monastic Christianity, of Jain and Hindu asceticism, and of the Buddhist rule on eating hours.
The solidarity argument is prominent in modern Muslim and Christian teaching: the fast gives the comfortable a short taste of what the poor experience without choosing it. Ramadan is bound to a sharp annual rise in charitable giving, which makes the connection concrete rather than rhetorical.
The clarifying argument holds that a lightened body sharpens prayer and perception, and it recurs in mystical writing across traditions with little regard for what else those traditions believe.
These are different claims and they imply different practices. A fast undertaken for solidarity has no reason to be hidden and every reason to be visible. A fast undertaken as discipline has good reason to be concealed, and several traditions instruct exactly that: the gospel injunction to wash the face and anoint the head so that the fasting is not seen is a direct attack on fasting as display, and the fact that it needed saying tells you what was happening.