Although yams and sweet potatoes are both angiosperms (flowering plants), they are not related botanically. Yams are a monocot (a plant having one embryonic seed leaf) and from the Dioscoreaceae or Yam family. Sweet Potatoes, often called ‘yams’, are a dicot (a plant having two embryonic seed leaves) and are from the Convolvulacea or morning glory family.
Yams, which are rarely seen in the U.S. and Canada but are a staple in tropical regions, can grow up to seven feet in length. The name is thought to derive from the West African word nyami, "to eat".
edit Source of confusion
In the United States, firm varieties of sweet potatoes were produced before soft varieties. When soft varieties were first grown commercially, there was a need to differentiate between the two. African slaves had already been calling the ‘soft’ sweet potatoes ‘yams’ because they resembled the yams in Africa. Thus, ‘soft’ sweet potatoes were referred to as ‘yams’ to distinguish them from the ‘firm’ varieties.
Today the U.S. Department of Agriculture requires labels with the term ‘yam’ to be accompanied by the term ‘sweet potato.’ Unless you specifically search for yams, which are usually found in an international market, you are probably eating sweet potatoes!