"But all these things they will do to you on account of my name, because they do not know him who sent me. If I had not come and spoken to them, they would not have been guilty of sin, but now they have no excuse for their sin. Whoever hates me hates my Father also. If I had not done among them the works that no one else did, they would not be guilty of sin, but now they have seen and hated both me and my Father." (John 5:21-24 ESV)
Jesus has just taught his disciples how abiding in him will result in bearing fruit, thus proving they are his disciples (v. 8), and that through this they will experience the fullness of joy (v. 11). Out of abiding and obedience to Christ, love flourishes and community grows (v. 17). Jesus speaks these commands and encouragements over his disciples, in order to prepare them for what is to come.
The passage shifts from love for one another to hatred from the the world. Jesus is soon to go to the cross, to be hated by the world in a colossal way. The ones he had come to save will reject him and be the ones to sentence him to the death that he would soon conquer for those who would believe. He warns his disciples that the hatred they will receive for abiding in him will be because the world does not truly know the name the disciples will preach.
In a few short sentences, Jesus explains why those who will go on to persecute them are guilty of the specific sins of hating and rejecting God. Even if Jesus had not spoken to or done works among the people, they would still be guilty of other sins, like all humanity. This passage is not giving anyone a full omission from all sin guilt if Jesus had not come. Rather, it is showing the depth of their sin because Jesus had come to them. The Jews that plotted his death, accused him of blasphemy and treason, and demanded his crucifixion had had many encounters with Jesus. The claim that they did not know him is not literal in the sense of familiarity. They did not know him because they were blinded to the reality that he was the Messiah they had been long awaiting.
They have no excuse then for their sin, their hatred and rejection of Jesus. He had told them about who he was and did many wonderful signs before them, proving himself to be more powerful than any who had come before him. He showed his authority over demons, over nature, over sickness, and over even death itself in the raising of Lazarus. They knew Jesus, the man who angered them and provoked jealousy in their hearts, but they did not know Jesus, the God-incarnate Savior who proved himself to be so in words and deed.
God in his sovereignty used the rejection of the Son to be the means through which salvation comes to the world. We have a God who is knowable. A God who has revealed himself and his salvation to us. And each day we have to opportunity to know him more fully and more deeply through his Word. Let us not take for granted the ways in which God has made himself known to us, and let us obediently abide in our beloved Savior.