While Jesus had referred to the Canaanite woman as a dog, He said he was sent only to the lost sheep of the house of Israel. I think if you ask those in the know to name one clear trait about sheep, it would be that they are just plain dumb, maybe one of the dumbest animals on earth with no common sense whatsoever. They need to be protected because they are so stupid – they need a shepherd.
One dog on the other hand can help shepherd an entire flock of sheep. So while the disciples may have enjoyed Jesus calling the Canaanite woman a dog, in the end, the joke is on them – they are the dumb sheep who need a shepherd to lead them, and this woman has just shepherded them into a new understanding of the world and of the Word of God. Read more here