In 1066 the Normans invaded England. The Norman kings and their nobility spoke Norman-French and required its use for legal documents, courts proceedings, and Parliamentary debates, though their conquered subjects continued to speak English.
The nobility ate the meat that the commoners raised. The commoners used English names for their animals, but the nobility used French names for their food. "Pig," "swine" and "cow" come from Anglo-Saxon English, but "pork" and "beef" come from French.
But, over time, the use of French began to decline, and nobles learned it from teachers for special uses rather than during normal activities in upper-crust social circles. Then, from 1347 to 1351, the Black Death swept through Europe, killing about a third of the population. The number of French teachers in Britain fell below the necessary number to teach all the nobility.
And so, in 1362, Edward III became the first king to address British Parliament in English. Very soon, even the royal court had switched to English. But by then the English language had absorbed a lot of words from Norman-French, including "beef" and "pork."
That's why English has the rare feature of calling certain animals by one name, and their meat by another.