The accepted custom is to recite the Beracha of "She’ha’kol" over coffee, and this is, of course, the Halacha. Interestingly, however, there is considerable discussion among the Poskim as to why this should be the case. The Rosh (Rabbenu Asher Ben Yehiel, 1250-1327) was of the opinion that if a fruit is boiled, the Beracha over the liquid is "Ha’etz," like the fruit itself. Seemingly, this should apply to coffee, which is produced by boiling coffee beans that grow on trees. And even the Rashba (Rav Shlomo Ben Aderet of Barcelona, 1235-1310), who disputes the Rosh’s ruling, concedes that if this is the primary use of the fruit – to boil it and drink the liquid – then the Beracha over the liquid is "Ha’etz." Clearly, the primary method of consuming coffee beans is by producing coffee, and so even according to the Rashba, there is reason to believe that the Beracha over coffee should be "Ha’etz."
As mentioned, common practice is to recite "She’ha’kol" over coffee, but the Poskim establish that the possibility of the proper Beracha being "Ha’etz" has certain implications. Namely, if a person mistakenly recited "Boreh Peri Ha’etz" over a cup of coffee, he has fulfilled his obligation, and does not then recite "She’ha’kol."
Hacham Ovadia Yosef added that this is true also if one mistakenly recited "Ha’adama" over coffee. He brought a view that a tree which produces fruit already within its first year does not have the Halachic status of a "tree" with respect to Berachot, and thus the Beracha over its fruit is "Ha’adama," and not "Ha’etz." The coffee bean tree produces the beans within its first year, and so there is room to argue that the Beracha over coffee is "Ha’adama." Therefore, if one recited "Ha’adama" over a cup of coffee, he has fulfilled his obligation and does not then recite "She’ha’kol."
Another practical application of this discussion is a case of one who eats a fruit together with coffee, as often happens at dessert. If one recites "Ha’etz" over the fruit before drinking the coffee, then the coffee might be covered by this Beracha, and, as such, one would not then recite "She’ha’kol" over the coffee, given the uncertainty as to whether it still requires a Beracha. Therefore, Hacham Ovadia Yosef advised that if one eats a fruit with coffee, he should have specific intention while reciting the Beracha over the fruit that the Beracha should not cover the coffee. If he does not have this intention, then he does not then recite a Beracha over the coffee, as the coffee might have been covered by the Beracha recited over the fruit.
This discussion demonstrates that when it comes to Berachot, we must be aware not only of which Beracha should be recited over a given food item, but also which Berachot would cover the food after the fact if they are recited, as this, too, is a significant factor in regard to the Halachot of Berachot.
Summary: Although it is accepted to recite "She’ha’kol" over coffee, it could be argued that the proper Beracha is "Ha’etz." Therefore, if one mistakenly recited "Ha’etz" over coffee, he does not then recite "She’ha’kol." And, if one is eating a fruit with his coffee, he should have specific intention that the Beracha recited over the fruit does not cover the coffee, and if he does not have this intention, he does not then recite a Beracha over the coffee.