The broken window fallacy was first expressed by the great French economist, Frederic Bastiat. Bastiat used the parable of a broken window to point out why destruction doesn't benefit the economy.
In Bastiat's tale, a man's son breaks a pane of glass, meaning the man will have to pay to replace it. The onlookers consider the situation and decide that the boy has actually done the community a service because his father will have to pay the glazier (window repair man) to replace the broken pane. The glazier will then presumably spend the extra money on something else, jump-starting the local economy. (For related reading, see Economics Basics.)
The onlookers come to believe that breaking windows stimulates the economy, but Bastiat points out that further analysis exposes the fallacy. By breaking the window, the man's son has reduced his father's disposable income, meaning his father will not be able purchase new shoes or some other luxury good. Thus, the broken window might help the glazier, but at the same time, it robs other industries and reduces the amount being spent on other goods. Moreover, replacing something that has already been purchased is a maintenance cost, rather than a purchase of truly new goods, and maintenance doesn't stimulate production. In short, Bastiat suggests that destruction - and its costs - don't pay in an economic sense.
The broken window fallacy is often used to discredit the idea that going to war stimulates a country's economy. As with the broken window, war causes resources and capital to be funneled out of industries that produce goods to industries that destroy things, leading to even more costs. According to this line of reasoning, the rebuilding that occurs after war is primarily maintenance costs, meaning that countries would be much better off not fighting at all.
The broken window fallacy also demonstrates the faulty conclusions of the onlookers; by only taking into consideration the man with the broken window and the glazier who must replace it, the crowd forgets about the missing third party (such as the shoe maker). In this sense, the fallacy comes from making a decision by looking only at the parties directly involved in the short term, rather than looking at all parties (directly and indirectly) involved in the short and long term.
For related reading, see Macroeconomic Analysis.