"You shall tithe all the yield of your field and eat it before the L-rd, your G-d, in the place He has chosen" (Devarim 14:22-23)
In the first, second, fourth and fifth years of the seven-year cycle, after one has set apart maaser rishon for the Levite, there is an obligation to set apart ten percent of the remainder and bring it to Yerushalayim and consume it there. If bringing it to Yerushalayim proves to be too difficult, one can redeem the produce and bring the money there and spend it solely on food and drink.
Sefer Hachinuch offers the same reason for this mitzvah, the one requiring a Jew to bring the fourth-year fruit to Yerushalayim for consumption and the one dealing with the tithe of cattle and flocks which had to be brought to Yerushalayim as sacrifices whose flesh would be consumed there by its owner.
The common denominator is that it was hardly possible for a Jew to consume such a massive amount of food during the three times a year he made a pilgrimage to Yerushalayim. It was therefore practical from an economic perspective for the owner or one of his sons to spend a substantial amount of time studying Torah in the city where the Sanhedrin was located. He could thus develop into a Torah scholar who would return home as an "in-house rabbi" who would be more effective in guiding and influencing his family than any community rabbi with whom there was only marginal contact.