Then when he says, How do you know me?, we have Nathanael's question. For Nathanael, in wonder at the divine power in this revelation of what is hidden, because this can only be from God—"The heart is depraved and inscrutable, and who is able to know it? I the Lord search the heart and probe the loins" (Jer 17:9); "Man sees the appearances, but the Lord sees the heart" (1 Sam 16:7)—asks, How do you know me? Here we can recognize Nathanael's humility, because, although he had been praised, he did not become elated, but held this praise of himself suspect. "My people, who call you blessed, they ...are deceiving you" (Is 3:12).
Then he touches on matters in the past, saying, Before Philip called you, I saw you when you were sitting under the fig tree. First we have the statement of Christ; secondly, the confession of Nathanael.
As to the first, we should note that Nathanael might have had two misgivings about Christ. One, that Christ said this in order to win his friendship by flattery; the other, that Christ had learned what he knew from others. So, to remove Nathanael's suspicions and raise him to higher things, Christ reveals certain hidden matters that no one could know except in a divine way, that is, things that related only to Nathanael. He refers to these when he says, Before Philip called you, I saw you when you were sitting under the fig tree. In the literal sense, this means that Nathanael was under a fig tree when he was called by Philip—which Christ knew by divine power, for "The eyes of the Lord are far brighter than the sun" (Sir 23:28).
In the mystical sense, the fig tree signifies sin: both because we find a fig tree, bearing only leaves but no fruit, being cursed, as a symbol of sin (Mt 21:19); and because Adam and Eve, after they had sinned, made clothes from fig leaves. So he says here, when you were sitting under the fig tree, i.e., under the shadow of sin, before you were called to grace, I saw you, with the eye of mercy; for God's predestination looks upon the predestined, who are living under sin, with an eye of pity, for as Ephesians (1:4) says, "He chose us before the foundation of the world." And he speaks of this eye here: I saw you, by predestining you from eternity.
Or, the meaning is, according to Gregory: I saw you when you were sitting under the fig tree, i.e., under the shadow of the law. "The law has only a shadow of the good things to come" (Heb 10:1).
Source: Commentary on John