When John was baptizing the people the Pharisees and religious leaders came to be baptized too. But he called them vipers because they thought it would make them look spiritual in the sight of the people. But you must repent or baptism does no good, and they had not repented of their wicked ways first.
Matthew 3:7But when he saw many of the Pharisees and Sadducees come to his baptism, he said unto them, O generation of vipers, who hath warned you to flee from the wrath to come? 8Bring forth therefore fruits meet for repentance
Jesus called them vipers because they were hypocritical, pretending they were following God but in their heart they weren't