A question that isn't really that important, however, it comes to my mind every time I read some Scripture verses. If the Mosaic Law forbids the consumption of pork meat, why do we see a pig farmer mentioned in the parable of the prodigal son, and some demons begging Jesus to send them in pigs (and it is mentioned that a swineherd man is taking care of them)? I know that Jesus states that nothing from outside (food) is unclean, or that no food is unclean unless you think is unclean, however, He told these parables to Jews so it means it was a common practice to keep pigs as livestock, and the swineherd that was taking care of the pigs, didn't know that Jesus announced that no food is forbidden. So the question is why did Jews at that time raise pigs if they don't eat pork, and pigs don't really have any other utility than consuming (maybe pork skin was used for shoes, however, this doesn't make it worth raising a pig to take its skin and to throw the meat away).
If your question is: "why did jews at that time raise pigs", then the answer is: The Jews didn't raise pigs. Let's look at the two examples you cite:
In Luke 15, the younger son goes away "to a far off country" (“εἰς χώραν μακρὰν” (Λουκᾶν 15·13 THGNT-T)). He's not in Jewish land anymore. Furthermore, it's clear that he's working with pigs, not because he wants to, but because he has to in order to survive. Note the "he came to his senses" language (“Εἰς ἑαυτὸν δὲ ἐλθὼν” (Λουκᾶν 15·17 THGNT-T))
In the second example (in Matthew 8), Jesus goes out of Jewish territory, "to the other side" (“εἰς τὸ πέραν εἰς τὴν χώραν” (Μαθθαῖον 8·28 THGNT-T)). The name of that region is the Gadarenes (or Gergesenes if you go with the variant reading). We do not know precisely where these were. But we do know that they were on the other side of the sea of Galilee where there were Gentiles (non-jews) living.
Might there have been Jews who raised pigs? Considering the harsh treatment they would have received from their fellow Jews, especially in the years after Antiochus IV, when they were forced to take on Greek customs, and then, as a result, pushed back with everything they had, reclaiming Jewish customs, it's hard to conclude that the Jews in Jesus' time would have farmed pigs.
And, as we saw from these two examples, the lands that are referred to in Luke 15, and Matt. 8, are Gentile lands.
If Jews are not allowed to eat pork why in the Bible appear pig farmers?
The exorcism of the Gerasene demoniac, frequently known as the Miracle of the (Gadarene) Swine was probably a Gentile area of Palestine and not a Jewish place of residence.
In addition, Scriptures do not say if the pigs were raised for food or if they were feral animals of the region.
Jesus Restores Two Demon-Possessed Men
28 When he arrived at the other side in the region of the Gadarenes,[a] two demon-possessed men coming from the tombs met him. They were so violent that no one could pass that way. 29 “What do you want with us, Son of God?” they shouted. “Have you come here to torture us before the appointed time?”
30 Some distance from them a large herd of pigs was feeding. 31 The demons begged Jesus, “If you drive us out, send us into the herd of pigs.”
32 He said to them, “Go!” So they came out and went into the pigs, and the whole herd rushed down the steep bank into the lake and died in the water. 33 Those tending the pigs ran off, went into the town and reported all this, including what had happened to the demon-possessed men. 34 Then the whole town went out to meet Jesus. And when they saw him, they pleaded with him to leave their region. - Matthew 8: 28-34
In your other example about the Prodigal Son, he was feeding the pigs out of necessity in order to make money. He himself was not a farmer. Also he was living in a pagan region far from home.
Whether or not the Jews raised swine here or there is not really a big issue here.
Yes, the Ancient Hebrews were not allowed to eat unclean animals, but that does not mean they could not sell it to foreigners to consume.
Do not eat anything you find already dead. You may give it to the foreigner residing in any of your towns, and they may eat it, or you may sell it to any other foreigner. But you are a people holy to the Lord your God. - Deuteronomy 14:21