Dogs and pigs were Jewish terms of derision used to describe Gentiles.
Read further before you get angry… deep breath…
Many Gentiles lived among the Jews and these were accepted by the Jews, even welcomed, because they observed the portion of the Law of Moses which instructed Gentiles on the requirements to live among the Jews. There were also “God fearing” Gentiles, those who believed in the God of Israel but had not become Jewish for some reason.
At Caesare’a there was a man named Cornelius, a centurion of what was known as the Italian Cohort, a devout man who feared God with all his household, gave alms liberally to the people, and prayed constantly to God. (Acts 10:2-3)
Cornelius was a “God fearing” Gentile but could not become Jewish because of his position in the Roman military.
God fearing Gentiles and Gentiles who lives peacefully as sojourners and obeyed the commands in Leviticus for dwelling among the Jews were not dogs or pigs. Dogs and pigs are those who refused to acknowledge the God of Israel and rejected the “pearls of wisdom” in the Law of Moses. The dogs and swine attacked Israel out of jealousy.
Remember that Matthew’s theme is Jesus the King and his kingdom. Matthew’s audience is Jewish.