We fast before Mass in order to prepare a proper dwelling for Jesus when we receive Him in the Eucharist. If the Pope were coming over would you clean your house? Of course you would! You'd even dust the crack in the floor, under the carpet, in the corner of the basement storage room!
It's the same when we open up the door of our body and soul to Jesus. We need to clean up and prepare!
The rules for fasting have evolved over the years. According to the Code of Canon Law we are required to fast from everything except water and medicine for one hour prior to receiving communion (Code of Canon Law 919).
Why is this necessary? Fasting is all about the 'disposition' of your soul. That means the 'condition' or 'state' that your soul is in. In order to prepare the soul, we have to prepare the body.
We are physical beings. When we force our body to do something hard, like not eat or drink, it reminds us that hunger and thirst for spiritual food is even more important.
Since the body and soul make up the one person that you are, they have to do things together . . . like get ready for Jesus in the Eucharist.