Coffee is sweet so we consider it to be a fruit. It's called a coffee cherry because it looks a bit like a cherry when it's ripe. However, when the two seeds inside the cherry are roasted, they are referred to as a beans, so that is why some people might think that coffee is a vegetable. The term 'bean' is actually rather misleading.