The purpose of fasting is to teach us self-restraint form the evil and to make us devoted towards Allah and Islam.
Quranic Verses
Oh, you who believe! Fasting is prescribed to you as it was prescribed to those before you, that you may learn piety and righteousness” [Quran,2:183]