13 The other Jews joined him in his hypocrisy, so that by their hypocrisy even Barnabas was led astray. -Galatians 2:13 BSB
The name Barnabas means “Son of Encouragement.” His real name was Joseph, a Levite, but he was called by the apostles Barnabas due to his character (Acts 4:36-37). He led by example in providing to the ministry of the apostles so that they could continue spreading the gospel of Jesus Christ. The apostles also used the money to help those who came to faith by covering their basic needs.
The Holy Spirit chose Saul, who was also known as Paul, and Barnabas to go to the island of Cyprus to bring the Word of God, the message of salvation, to the Jewish people there (Acts 13:4-5).
Paul witnessed how dangerous compromising one’s faith can be that not only does it have the potential to destroy the person’s faith, but such a faithless decision will take others with them as well. Peter’s hypocrisy impacted Barnabas’ faith, which caused him to fear the Jews, leading him to error, see the commentary of Galatians 2:12.
12 For before certain men came from James, he used to eat with the Gentiles. But when they arrived, he began to draw back and separate himself, for fear of those in the circumcision group. -Galatians 2:12 BSB
The hypocrisy of Peter was seen in this way: Jews wouldn’t associate with Gentiles, visit their homes, or sit down to have a meal with them. The reason is that the Jews didn’t want to participate with the Gentiles in any form and fall into their pagan beliefs or practices (see Deuteronomy 7:3-4 below). However, Peter understood if a Gentile and Jew have put their faith in Jesus Christ, they are one in the Lord and are brothers in Christ.
3 Do not intermarry with them. Do not give your daughters to their sons or take their daughters for your sons, 4 because they will turn your sons away from following Me to serve other gods. Then the anger of the LORD will burn against you, and He will swiftly destroy you. -Deuteronomy 7:3-4 BSB
When James came accompanied by Jews, Peter felt fear that he would get caught eating with the Gentiles, so he removed himself from them, showing his hypocrisy because before James and the other Jews came, Peter had no problem eating with them.