In Acts 21:11 a prophecy has been delivered to Paul that he will be arrested and handed over to the Gentiles if he goes to Jerusalem. Paul goes anyway.
In verse 17 he and his traveling party arrive in Jerusalem. In the following verses he shares with the leaders of the church there what has been happening with his preaching to the Gentiles; the leaders share that thousands of Jews have become believers, but there is also this rumor that Paul is teaching the Jews living among the Gentiles to abandon their religious practices including circumcision. The leaders encourage Paul to go to the temple with four men who are completing a nazirite vow, and pay their offering to show he is still a good Jew. (Samson parents were told to raise him as a nazirite from birth which is why he needs to keep his hair long in his story in Judges 13-16.)
Paul does what is suggested but there are Jews from Asia Minor, where Paul has been doing ministry, who grab him, falsely claiming that he has brought Gentiles into the temple. This causes an uproar and Paul is the one arrested. Paul asks the commander if he can speak to the crowd which brings us to chapter 22.
Paul recounts his experience on the road to Damascus years earlier (see Acts 9). The crowd listens until Paul says that the Lord told him, “I will send you to the Gentiles.” The crowd is ready to kill Paul. Now the Roman commander orders Paul to be whipped but Paul states that he is a Roman citizen, and that is not done to citizens who haven’t been found guilty of some crime.
The commander still doesn’t know what the problem is so he orders the Jewish council to assemble the next day and has Paul address them.
And now we are in chapter 23. Paul notices that there are both Pharisees and Sadducees gathered and proclaims that he is on trial because of his hope in the resurrection of the dead. This leads to the two groups arguing with each other so intensely that the commander is afraid that they will tear Paul to pieces. (Remember that the Sadducees don’t believe in the resurrection while the Pharisees do.)
Paul then receives a vision that night that he will testify about Jesus in Rome just as he has done in Jerusalem.