Bacon and ham are both cuts of meat taken from a pig (pork). The difference lies in what parts of the pig the cuts are from, and how the meat is cured.
Bacon is meat taken from the back, loin or belly of the pig. Bacon is either dry cured in cold air or by smoking or packed with large amounts of salt, or wet cured when it is immersed in liquid brine.
Ham is meat cut from the thigh or rump of the pig. Ham can be cooked and served fresh or wet or dry cured usually with less salt and more sugar.
There are many types of bacon depending on the thickness and which part of the pig it is cut from. Back bacon has less fat and more meat, and is taken from the loin of the pig and then cured. Streaky bacon is made from the pork belly - the 'streaks' refer to fat running through each slice or rasher. In Italy, uncooked cured cubes of bacon with a layer of fat is called pancetta. Cottage bacon is thinly sliced pork shoulder cut into meaty oval shapes. Jowl bacon is smoked and cured pig cheeks. Gammon, commonly eaten in the UK and Ireland is from the hind leg of the pig and traditionally 'Wiltshire cured' (a traditional cure using brine which originated in Wiltshire, England).
Types of ham vary between countries. In Italy cured or cooked ham is called Proscuitto; in France wet-cured boneless ham is called Jambon de Paris; Parma ham from Italy uses little salt and includes sugar and garlic salt to cure it sealed with pig fat to slow the drying; in Spain Serrano ham comes from white pig; tinned ham common in the US is smaller cuts of meat sold in tins with [aspic jelly].
edit Ways of eating
Bacon can be fried, grilled, boiled, smoked or baked. It can be chopped into 'bacon bits' and used as a topping for many dishes including pizza and salad. Bacon is also wrapped around other meat such as chicken breast to impart fat and flavor. Bacon lard or fat is used for basting roasting meats. Bacon is most commonly eaten as slices or 'rashers' in sandwiches or for breakfast with eggs and toast.
Ham is commonly used as slices in salads and sandwiches. On special occasions such as Christmas, a Christmas Ham which is a whole leg of ham is studded with cloves and coated with a sugary maple coating and baked before slicing.