Paul told his Corinthian followers that in order to persuade people who were under the law, he would sometimes act as if he was under the law. But he said he wasn’t actually under the law.
Then he said in order to persuade people who weren’t under the law, he would sometimes act as if he was not under the law. But he said he actually was under God’s law, and not free from it. Which is just the opposite of what he just said in the previous verse.
Some Jewish Christians who still zealously followed God’s law (including some of Jesus’s original disciples) heard that Paul was teaching Jews that they didn’t need to follow God’s law anymore. So they urged Paul to publicly join them in their rituals. That way everyone would know that those reports were false, and that Paul was in fact living under the law. And Paul did go along and do that, so he must really have been living under the law, right? Unless that was one of those times when he was just pretending…
Paul told the Philippians that he was faultless in his righteousness based on the law. (He went on to say he was no longer proud of that. But he didn’t make clear whether or not his change in attitude meant he wasn’t actually under the law anymore…)