John's gospel has:
Now before the Feast of the Passover, when Jesus knew that his hour had come to depart out of this world to the Father, having loved his own who were in the world, he loved them to the end.
(John 13:1, ESV)
The next action Jesus washed their feet. The finale, Jesus gave his life for us.
In 13:10 Jesus added the common custom of a servant washing feet of guest They washed their feet because they walked on dirt roads. That is what got dirty and all that needed washing. Jesus was emphasizing his action as that of a servant.
10 Jesus said to him, “The one who has bathed does not need to wash, except for his feet, but is completely clean. And you are clean, but not every one of you.”
(John 13:10, ESV)
Of course Jesus gave a spiritual since to bathing. "Completely clean" would be fulfilled with his sacrifice.
13:9–11. The “bath” here presumably alludes to ceremonial washing that Jesus and the disciples had undergone before the feast (11:55), but Jesus applies it in a spiritual sense. This figurative sense of cleansing was common enough that the disciples should have been able to understand his meaning.
Keener, C. S. (1993). The IVP Bible background commentary: New Testament (Jn 13:9–11). Downers Grove, IL: InterVarsity Press.
But, the primary point Jesus sought to get across was to love by serving others.
Do you understand what I have done to you? 13 You call me Teacher and Lord, and you are right, for so I am. 14 If I then, your Lord and Teacher, have washed your feet, you also ought to wash one another’s feet. 15 For I have given you an example, that you also should do just as I have done to you.
(John 13:12–15, ESV)
Later Jesus said:
A new commandment I give to you, that you love one another: just as I have loved you, you also are to love one another. 35 By this all people will know that you are my disciples, if you have love for one another.”
(John 13:34–35, ESV)
This is my commandment, that you love one another as I have loved you. 13 Greater love has no one than this, that someone lay down his life for his friends.
(John 15:12–13, ESV)
Thus, while 13:10 has a secondary meaning of the disciples being cleaned by forgiveness of sins, its primary meaning is Christ showing is servant-like love as an example for us to follow.
Do nothing from selfish ambition or conceit, but in humility count others more significant than yourselves. 4 Let each of you look not only to his own interests, but also to the interests of others. 5 Have this mind among yourselves, which is yours in Christ Jesus, 6 who, though he was in the form of God, did not count equality with God a thing to be grasped, 7 but emptied himself, by taking the form of a servant, being born in the likeness of men. 8 And being found in human form, he humbled himself by becoming obedient to the point of death, even death on a cross.
(Phil. 2:3–8, ESV)
Appendix: References for custom of washing feet
Custom required a kiss of greeting, usually on the face. After the guests were seated on stools around the broad U-shaped dining couch, called a triclinium, water and olive oil would be brought for the washing of hands and feet. Only then could the grace be offered.
Bailey, K. E. (2008). Jesus through Middle Eastern Eyes: Cultural Studies in the Gospels (p. 242). Downers Grove, IL: IVP Academic.
44 Then turning toward the woman he said to Simon, “Do you see this woman? I entered your house; you gave me no water for my feet, but she has wet my feet with her tears and wiped them with her hair. 45 You gave me no kiss, but from the time I came in she has not ceased to kiss my feet. 46 You did not anoint my head with oil, but she has anointed my feet with ointment. 47 Therefore I tell you, her sins, which are many, are forgiven—for she loved much. But he who is forgiven little, loves little.”
(Luke 7:44–47, ESV)
13:5. Foot-washing was needed in Palestine. The streets were dusty and people wore sandals without socks or stockings. It was a mark of honor for a host to provide a servant to wash a guest’s feet; it was a breach of hospitality not to provide for it (cf. 1 Sam. 25:41; Luke 7:40–50; 1 Tim. 5:10). Wives often washed their husbands’ feet, and children washed their parents’ feet. Most people, of course, had to wash their own feet.
Blum, E. A. (1985). John. In J. F. Walvoord & R. B. Zuck (Eds.), The Bible Knowledge Commentary: An Exposition of the Scriptures (Vol. 2, p. 320). Wheaton, IL: Victor Books.
After travelers had come a long distance, the host was to provide water for their feet as a sign of hospitality, as exemplified by Abraham (Gen 18:4). Yet loosing sandals and personally washing someone else’s feet was considered servile, most commonly the work of a servant or of very submissive wives or children (cf. also 1 Sam 25:41). (Travelers’ sandals would not be covered in dung, as some scholars have suggested. Side roads were very dusty; the main streets of Jerusalem, however, would have been kept as clean as the city could make them, especially the Upper City, where Jesus ate this Passover meal.) Jesus’ removing his outer garments to serve them would also appear as a sign of great humility before them.
Keener, C. S. (1993). The IVP Bible background commentary: New Testament (Jn 13:3–8). Downers Grove, IL: InterVarsity Press.