What is the difference between a yam and a sweet potato?
They are completely unrelated plants, and most things sold as "yams" in supermarkets — particularly in the United States — are sweet potatoes.
Sweet potatoes belong to the morning glory family. They have smooth, thin skin, taper at both ends, and the flesh may be orange, white, purple or yellow. They are sweet, moist when cooked, and originate in Central and South America.
True yams belong to an entirely different family. They have rough, bark-like, often hairy skin, are cylindrical, and can grow enormous — some species reach well over a metre and 50kg. The flesh is white or purple, starchy and dry rather than sweet, closer in texture to a potato. They are native to Africa and Asia and are a staple food across West Africa in particular.
The naming confusion is American and historical. Orange-fleshed sweet potatoes were introduced to the southern United States and marketed as "yams" — reportedly from a West African word for the true yam — to distinguish them from the paler varieties already grown there. The label stuck, and US labelling regulations now require "sweet potato" to appear alongside it, though the colloquial name persists.
So if you buy a "yam" in an American supermarket it is almost certainly a sweet potato. Genuine yams are usually found in African, Caribbean and Asian grocers.
They are not interchangeable in cooking. Sweet potato's sugar caramelises and it turns soft and moist; yam stays firm and starchy and is typically boiled, pounded or fried.
Neither is closely related to the ordinary potato, which is a nightshade.