Having described the glory Christ received from the helpfulness of his friends and from the devotion of the crowd, the Evangelist now describes the glory Christ received from the devotion of the Gentiles. First, the devotion of the Gentiles is mentioned; secondly, this devotion is reported (v 22); and thirdly, we see the prediction of Christ's passion (v 23). Concerning the devotion of the Gentiles, two things are set forth: first, their devotion to the sacraments of the Old Law; secondly, their devotion to Christ (v 21).
The devotion of the Gentiles to the sacraments of the Old Testament is ...shown by the fact that they visited the temple. Thus he says, Now among those who went up, to Jerusalem, to worship at the feast were some Gentiles. He is saying in effect: Not just the Jews, but the Gentiles, also, honored Christ. According to a Gloss, the reason why they went up to Jerusalem was because they were proselytes, who had been converted to the Jewish rite by the preaching of those Jews who were scattered throughout the world, and who strove to convert whomever they could: "You traverse sea and land to make a single proselyte" (Mt 23:15). And so, in keeping with the Jewish rite, they went up with the others.
But a better reason is given by Chrysostom, namely, that as we read in Maccabees (3:2), the temple of God in Jerusalem was held in such esteem by all the people and rulers throughout the world that they considered it an honor to glorify the temple with the finest gifts. And so it happened that on the feast days even many Gentiles would go up to Jerusalem. An example of this is mentioned in the Acts (8:27), where it tells of a eunuch, a minister to Queen Candace of Ethiopia, who had come to Jerusalem to worship. Thus Isaiah says: "My house shall be called a house of prayer for all peoples" (Is 56:7). The fact that these Gentiles came to the temple out of devotion prefigured the conversion of the Gentiles to the faith.
Source: Commentary on John