There are a number of possible meanings to help us understand this event, though none seem particularly compelling. It's possible that the full import of the event was clear to people living in the Levant 2,000 years ago, but are obscure to use today.
One of the most obvious meanings is that Jesus is a great King. The Hebrew Bible itself has many examples of the anointing of kings (1 Samuel 16). According to Keifer, the large amount and description of nard as "pure" implies kingly status (Oxford Commentary, 2001).
Many scholars recognize that Jesus is the "ultra" or "ultimate" in all His roles - if Moses and Elijah fasted for 40 days, Jesus spent 40 days without food or drink, making Him the "ultimate prophet." So while it's unusual to anoint the feet rather than the head of a king, the amount of nard (far too much for one person's feet), purity, and location of the anointing elevate Jesus to an ultimate status.
This also fits the cosmogony of ancient Israelites. The head is the highest and most respected part of the body, the feet the dirtiest and lowest (Hanson and Oakman, 1998). A woman's hair is her "glory" (1 Cor 11:15). When Mary used her hair to wipe Jesus' feet it may have been a shocking tribute.
It's already somewhat scandalous that Mary entered a room where men are dining, since that was a shameful violation of male space that implied she had no self-respect (Fiorenza, 1983). To lower herself by using her hair on Jesus' feet might be even more disturbing. It points to Jesus' heavenly status, a challenge to male status that might have led Judas to speak - as he couldn't wait to initiate a final showdown between Jesus and the Jerusalem authorities later, so Judas couldn't keep silent as all cultural mores were upended.
The anointing of Jesus' feet also echoes the "sinful woman's" (was her sin that she merely violated male space?) anointing of Jesus' feet with tears in Luke 7. John is considered the latest-written of the four gospels and seems to have included elements from the three earlier (Perkins, 2012). So some of the symbolism may foreshadow Jesus' death as atonement for others' sins, as that meaning was paramount in Luke 7.
Further symbolism includes the intimate nature of Mary's hair caressing Jesus' feet. Some point out that "feet" was a euphimsim for sexual organs, but that doesn't seem to make much sense here - it would be extremely strange for Judas to then object to the cost of nard! Only unqualified scholars stretching to impute sexual overtones in John's largely asexual depiction of Jesus could waste time on that possibility.
Instead, there's a stunning intimacy about stroking another's feet with hair that is in itself disruptive. Numerous scholars and anthropologists point out that outside of blood relations and marriage, male and female spaces were highly divided (for some of the best scholarship on distinct spaces, see Douglas, 1999). To allow this intimate gesture was taboo, and probably even more rare for a religious teacher. The Lukan account (probably of a separate anointing) more explicitly captures this aspect, as the host objects to the nature of the touching. Again, this points to Jesus' heavenly status - it's no problem for Jesus to accept the woman's ministrations, since they are only His due.
It's also notable that only in John does Nicodemus offer spices for the burial anointing. So the anointing by Mary of Jesus' feet is clear foreshadowing, a basic literary tool. But this particular foreshadowing helps John share his Christology: Jesus was already the fully-realized Son of God even prior to the Resurrection, which seems to be in slight tension with Mark. Since in John, Jesus' glory is fully realized on the Cross (when He is "lifted up") rather than after risen, the book-ends of royal anointings - Mary before death (right after the Sanhedrin formally decides to kill Jesus) and Nicodemus (at least in intent) after His death, helps maintain the Crucifixion as the high point of Jesus' influence.
Each of these paragraphs can lead to a lot more detailed consideration. It's worth saying that while all of these interpretations are solid not only because they make sense but also because they fit John's narrative arc very well, none of them alone seems to warrant including such an odd and potentially scandalous scene in this or any gospel.