It actually comes from the Latin word "cafetum", which means "coffee shop" or "coffee house". The word was further adapted from the French word "café", which also means "coffee".
The term "cafeteria" was first used in the United States in the early 20th century to describe a self-service restaurant where customers choose their food from a selection on display.