Coffee plants grew wild in East Africa, and sometime before 1000 AD, the people who lived in Ethiopia, in East Africa, began to mash up the red coffee berries and mix them with fatty meat (like bacon) to make an energy bar like the North American pemmican.
By about 1000 AD, the Ethiopians were selling coffee beans to Islamic traders, who brought the coffee beans back to the Arabian peninsula in the Abbasid Empire to sell there. Slowly more and more people heard about coffee, and traders began selling coffee all over the Abbasid Empire. Farmers grew coffee in the Arabian Peninsula, and did their best to keep anyone else from getting any coffee plants, so that they could charge whatever they wanted for coffee.
By 1453, people in the Ottoman Empire figured out how to roast the beans, grind them, and brew coffee into a drink. Because Muslims were not supposed to drink wine or beer, a lot of people began serving coffee to their guests instead.
For more information about coffee, check out these books from Amazon.com or from your library:
Ancient Agriculture: From Foraging to Farming, by Michael and Mary Woods (2000). For middle schoolers, with plenty of information about how farming got started, and how it worked.
Oats, Peas, Beans and Barley Cookbook, by Edyth Young Cottrell (1974).
Famine and Food Supply in the Graeco-Roman World : Responses to Risk and Crisis, by Peter Garnsey (1988). By a leading specialist in Greek and Roman food and farming, and not too hard to read. Especially good on crop failure.