The main purpose of fasting during Ramadan is to cleanse oneself and to become a better and more spiritual purpose.
During Ramadan, Muslims are not just supposed to refrain from eating and drinking during the daylight hours. Instead, they are supposed to try to refrain from any bad actions during that time. They are supposed to be making their entire life as much like an act of worship as possible.
When Muslims do this, they are trying to become more spiritual. They are trying to leave worldly things behind to the extent possible and to focus more on their faith and their spiritual lives.