What Is The Philosophy Of Fast?

There are various aspects associated with the fasts and they also possess numerous physical and spiritual effects and benefits, which tend have a great impact upon man - the most important of them being their ethical aspect and their educative philosophy.
Some of their important benefits are that they make man’s soul kind, strengthen his determination and moderate his instincts.
When an individual fasts, despite his hunger and thirst, he must stay away from food, water and sexual pleasures and prove, in practice, that he is not an animal within a stable but an entity that can rein in his wild soul and overcome his lust and carnal desires.
In fact, the most important philosophy of the fasts is this spiritual effect; man, who has a variety of food and drinks at his disposal and can reach out for them the moment he experiences thirst or hunger, is like the trees that grow near the rivers, seeking support of the walls of the gardens.  These fondled and pampered trees possess less resistance and are short-lived.  If water does not reach them for a few days they immediately dry up and wither away.  In contrast, the trees which grow between the rocks on the mountains or in the deserts and which are pampered from their incipience by strong storms, scorching rays of the sun and harsh winters, and are deprived of luxuries, are strong, durable and highly resistant!
Fasts act similarly with man’s soul, granting it - in exchange for temporary restrictions - a strong determination, steadfastness, and the ability to face up to hardships and severe occurrences, and since it controls the unruly instincts, it makes man’s heart pure and luminous.
In short, fasts heave man out of the world of animals and elevate him into the realm of angels, and the expression لَعَلَّكُمْ تَتَّقُونَ (so that you may guard (against evil)) in the verse 183 of the chapter al-Baqarah(1) , while mentioning the philosophy behind the fasts, also bears an allusion to all of the above realities.
The well-known tradition الصَّوْمُ جُنَّةٌ مِنَ النَّارِ (The fast is a shield against the fire (of Hell))(2)  is also a reference to this issue.
In another tradition from Imam A’li (as) we read that some companions asked the Holy Prophet (peace be upon him and his holy progeny): What should we do to keep the Satan away from us?  He (peace be upon him and his holy progeny) replied: Fasts blacken the face of the Satan; charity in the way of God breaks his back; befriending someone for the sake of God and perseverance in performing good deeds cuts his roots and seeking forgiveness severs the vein of his heart.(3)
In Nahjul Balaghah, while explaining the philosophy of the various acts of worship, Imam Ali (as), upon reaching the fasts says:

وَ الصِّيَامَ ابْتِلَاءً لِإِخْلَاصِ الْخَلْقِ

(God ordered the observance of fasts for fostering (the attribute of) sincerity within the people)) (4)
And again, in another tradition of the Holy Prophet (peace be upon him and his holy progeny), we read:

إِنَّ لِلْجَنَّةِ بَاباً يُدْعَى الرَّيَّانَ لَا يَدْخُلُ مِنْهُ إِلَّا الصَّائِمُونَ

(Paradise has a door by the name of ‘Rayyaan’ (the sated one) and none shall enter Paradise through it except those who fast).
The late Sheikh Saduq, explaining this tradition in his book Ma’ani al-Akhbaar, says: The reason for selecting this particular name for this door of Paradise is that the maximum inconvenience suffered by a person who fasts is due to thirst; when they shall pass through this door, they shall be quenched in a manner that they shall never
experience any thirst, ever again.(5)

References

1-يا أَيُّهَا الَّذِينَ آمَنُوا كُتِبَ عَلَيْكُمُ الصِّيامُ كَما كُتِبَ عَلَى الَّذِينَ مِنْ قَبْلِكُمْ لَعَلَّكُمْ تَتَّقُونَ‏ (Translator’s comments)
2-  Bihaar al-Anwaar vol. 96, vs. 256.
3-  Ibid, pg. 255.
4-  Nahjul Balaghah, saying 252.
5-  Bihaar al-Anwaar vol. 96, pg. 252.