Paul has finally arrived in Jerusalem after his 3rd missionary journey. He relates the works of God among the Gentiles to James and the elders, but then James informs him of a group of Jews that believe roomers that Paul is castigating the Moses and the Law in such a way that it is offensive to Jewish sensibilities. Paul agrees with the elders to submit with 4 other men in the process of a Nazarite cleansing ceremony and offerings, but before he is able to finish this ceremonial cleansing, the people pull Paul out to accuse him of teaching against the people and the law. Paul is beaten for doing what is right, and Eventually the authorities (the tribune – v. 31) have to step in to stop the beating of Paul by arresting him and imprisoning him.
Paul did not compromise his convictions concerning the gospel as some people believe, but was able to accommodate to Jewish sensibilities (He became a Jew to win the Jews (1 Cor. 9:20) He did not allow his freedom to tear down weaker brothers. The Jews in this chapter are the weaker Christians and the Gentiles the Stronger.
In Acts 15 the Jerusalem counsel including James decided that the Gentiles did not need to keep the Jewish laws in order to be saved. Here in Acts 21, Paul is showing us that in a Jewish culture that one should be accommodating to weaker brothers when it doesn't involve denying the Gospel.
You don't need to compromise your beliefs, but you can accommodate weaker brothers in Christ. One should always remember that even if accommodation is the right thing to do, it doesn't guarantee that everything will turn out right. Christians will suffer for doing what is Right, just don't compromise for the sake of unity – stick to your convictions.