Roasting coffee transforms the chemical and physical properties of green coffee beans into roasted coffee products. The roasting process is what produces the characteristic flavor of coffee by causing the green coffee beans to expand and to change in color, taste, smell, and density.
As green coffee is more stable than roasted, the roasting process tends to take place close to where it will be consumed.
The vast majority of coffee is roasted commercially on a large scale, but some coffee drinkers roast coffee at home in order to have more control over the freshness and flavor profile of the beans.