1 Cor 9:19-23, 1 Cor 10:31, Rom 14:6,

Paul came to Jerusalem and reported to the Jerusalem church about the evangelism work that God had done to the Gentiles. But when they heard through the rumor that Paul was saying that Gentiles should not be circumcised and should not keep the law, they thought that Paul was not keeping the law. In order to show that he himself was a law keeper, Paul practiced the law with them and cut his hair. (Acts 21:17-26)

Acts 21:17And when we were come to Jerusalem, the brethren received us gladly. 18 And the day following Paul went in with us unto James; and all the elders were present. 19 And when he had saluted them, he declared particularly what things God had wrought among the Gentiles by his ministry. 20 And when they heard it, they glorified the Lord, and said unto him, Thou seest, brother, how many thousands of Jews there are which believe; and they are all zealous of the law: 21 And they are informed of thee, that thou teachest all the Jews which are among the Gentiles to forsake Moses, saying that they ought not to circumcise their children, neither to walk after the customs. 22 What is it therefore? the multitude must needs come together: for they will hear that thou art come. 23 Do therefore this that we say to thee: We have four men which have a vow on them; 24 Them take, and purify thyself with them, and be at charges with them, that they may shave their heads: and all may know that those things, whereof they were informed concerning thee, are nothing; but that thou thyself also walkest orderly, and keepest the law. 25 As touching the Gentiles which believe, we have written and concluded that they observe no such thing, save only that they keep themselves from things offered to idols, and from blood, and from strangled, and from fornication. 26 Then Paul took the men, and the next day purifying himself with them entered into the temple, to signify the accomplishment of the days of purification, until that an offering should be offered for every one of them.

To save Jews and Gentiles, Paul became to the Jews as under the law and to the Gentiles as one without the law. (1 Cor 9:19-23)

1 Cor 9:19 For though I be free from all men, yet have I made myself servant unto all, that I might gain the more. 20 And unto the Jews I became as a Jew, that I might gain the Jews; to them that are under the law, as under the law, that I might gain them that are under the law; 21 To them that are without law, as without law, (being not without law to God, but under the law to Christ,) that I might gain them that are without law. 22 To the weak became I as weak, that I might gain the weak: I am made all things to all men, that I might by all means save some. 23 And this I do for the gospel's sake, that I might be partaker thereof with you.

Paul did all things for the Lord. (1 Cor 10:31, Rom 14:6)

1 Cor 10:31 Whether therefore ye eat, or drink, or whatsoever ye do, do all to the glory of God.

Rom 14:6 He that regardeth the day, regardeth it unto the Lord; and he that regardeth not the day, to the Lord he doth not regard it. He that eateth, eateth to the Lord, for he giveth God thanks; and he that eateth not, to the Lord he eateth not, and giveth God thanks.