Yahweh told Israel not to eat pork. He also told them not to worship or pray to idols. He didn’t mention eating food that had been offered to idols.
In Acts 15, Luke recorded some of the discussion and the resulting letter that the Jewish leaders of the Church wrote to Gentiles who were becoming believers and facing some Jews instructing them regarding laws given through Moses. The leaders told the converts not to eat food that had been sacrificed to idols, and a couple other rules that they had boiled the whole law down to. 3 rules about food and one about sex.
In 1 Corinthians 10, Paul told the believers in Corinth that it was OK to eat anything, with consideration for others’ well being. If they went to someone’s home to eat, don’t ask if the food had been offered to idols. Just pray for it to be sanctified (1 Timothy 4). If someone told them the food had been sacrificed, then don’t eat it so that you don’t weaken the faith of the one who offered it. Enjoy your liberty, but don’t be offensive.
All things are lawful, but not everything is beneficial, for me or for my neighbor. Be kind.