This is a legend that originated some time in the Middle Ages, but has sporadically continued up to at least the 20th Century.
Supposedly, as Jesus Christ was being whipped and abused as he was led out of the city, a particularly cruel man in the crowd spit on him, or punched him the face, or...