Extinguishing a fire in order to produce charcoal is one of the 39 melakhot prohibited on Shabbat. In the Mishkan they would turn wood into charcoal by setting fire to wood and then extinguishing it. They would then use this charcoal to build a steady and long-lasting fire for preparing the dyes used to color the curtains in the Mishkan. Similarly, if one extinguishes the flame of a candle so that its wick will light more easily later on, he transgresses a Torah prohibition.
What about one who extinguishes a fire not because he wants the charcoal, but because he wants to conserve fuel, or because the light produced by the flame is bothering him? In other words, he is not essentially interested in putting out the fire; he simply does not want the candle to keep burning. The Tanna’im disagree about this. According to R. Shimon, since this is a melakha she-eina tzerikha le-gufah (a melakha that is not needed for its own sake) it is only prohibited rabbinically. However, according to R. Yehuda, even if one’s objective is not the performance of the melakha itself, since he does in fact intend to extinguish the flame, he has performed a melakha and violated Torah law (Shabbat 31b and 93b).
Practically speaking, Rambam maintains that a melakha she-eina tzerikha le-gufah is prohibited by Torah law (MT 1:7), while according to most Rishonim it is rabbinically prohibited (R. Hai Gaon, Rabbeinu Ĥananel, Ha-ma’or, Ramban, and others; see also SA 334:27 and MB ad loc. 85). Since the only difference between a melakha she-eina tzerikha le-gufah and a regular melakha is the intention behind it, performing a melakha she-eina tzerikha le-gufah is considered more severe than violating a standard rabbinic prohibition. (See above 9:6.)