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.
Pigs were a very popular source of food all through antiquity, from West Asia all the way to England, 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 is also relatively easy to preserve by smoking it or salting it, to make bacon and salami. Germanic people in Eastern Europe, and the Romans, were especially known for their hams and salamis.
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 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.
The earliest Christians, who lived in Israel, also 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.