Pigs naturally like to live in forests, especially where there are oak trees that make acorns, because pigs like to eat acorns. At first people hunted wild pigs in the forest. The male wild pigs are called boars. But wild boars are very dangerous to hunt. They are smart and they have long sharp tusks and teeth.
It is much safer to domesticate pigs and have them tame, although even tame pigs can still be very dangerous (still, people are more dangerous to pigs than pigs are to people!). People first began to keep tame pigs about 10000 BC, in Central Asia. From Central Asia, tame pigs spread slowly east to China, and south-west to West Asia and North Africa. People also tamed pigs separately in Europe, maybe about the same time. In central Europe (what's now southern Germany and Austria), people combined their pigs with the salt from the big salt mines there and got really good at preserving pig meat by making it into hams and bacon and sausages.
Pigs were a very popular source of food all through antiquity, from West Asia all the way west to to England and east to China, from Scandinavia to North Africa. Pigs care for themselves pretty independently, and they will eat apple cores and rotten meat and peapods, so you can feed them on garbage. Pig meat's easy to preserve with salt, and bacon and ham are delicious, fatty, salty foods.
But from at least 1500 BC, Egyptian people seem to have thought that pigs were kind of yucky, something only poor people would eat. Possibly as a result of Egyptians conquering them during the New Kingdom, most Semitic people in West Asia, including not only most Jews but also other people like the Phoenicians and the Arabs, would not eat pig meat. The Bible and the Koran both say that Jews and Muslims should not eat pig meat. Further south in India, too, most people did not eat pig meat.
At the end of the Bronze Age, when the Greeks invaded Israel and settled there as the Philistines, they brought European pigs with them to Israel. That would have been another reason why the Jews didn't like the Philistines - they kept pigs. Probably the Hellenistic Greeks and the Romans, too, when they conquered Israel, brought European pigs with them.
The earliest Christians, who lived in Israel, like the Jews did not eat pork, but by about 50 AD many Christians came from places where people did eat pork, like Greece, and the Christians decided that this rule did not apply to them.
Video of a pig
When Mohammed told the Arabs about the new religion of Islam, he also said that Muslims (people who followed Islam) should not eat pork. So pigs became much less common around the Mediterranean and in West Asia after about 700 AD, and they are still very uncommon today. But in Europe and in China, where people were Christian or Buddhist or Taoist and not Muslim, pigs remained very common.
To find out more about pigs, check out these books from Amazon or from your local library: