All Ham Is Pork, But It Doesn't Really Work The Other Way Around
You have probably heard the statement before that "all bourbon is whiskey, but not all whiskey is bourbon." This is because bourbon is a type of whiskey, and there are certain specifications for what can be considered bourbon whiskey. Additionally, there are several other versions of whiskey including Scotch and Irish whiskey. The same distinction holds true for ham and pork. While all ham is pork, not all pork is ham.
Pork is classified as being any type of cut from a pig coming from any part of the pig. Thus, in general, when you're eating meat from a pig, you're consuming pork. Ham, however, is a cut of pork that derives specifically from a pig's upper hind leg (via BBQ Host). And much like whiskey, different varieties of pork abound. Bacon comes from the pork belly, salami is taken from a pig's neck, and pork butt, the cut used to make that BBQ classic pulled pork, despite the name is actually upper pig shoulder (per MasterClass).
Flavor contrasts
There are countless other important differences between ham and pork as well, from shelf life to flavor to nutritional value. Ham is typically filled with preservatives such as salt or "cures" that allow it to be stored longer than other cuts of pork. Moreover, hams, whether purchased as a whole bone-in or in the form of boneless deli meat slices, are ready-to-eat as opposed to pork. The latter is often available raw and/or uncured and needs to be cooked or transferred to the freezer (via DRJ Catering).
The flavor between ham and other kinds of pork can vary quite a bit, as ham can be smoked, salt-cured, or served with a honey glaze. Its smokiness, saltiness, or sweetness can contrast with the mild flavor of pork. All that salt curing can add up, resulting in a higher sodium content in ham compared to pork, though ham rallies back by providing a good source of iron (per Tired Texan BBQ). Much like varieties of whiskey, each individual will develop their own unique preferences, and discover if ham or other types of pork suit their tastes better.