In theory, a good speculator allocates money more efficiently. In 2004 this might have meant shorting Bear Stearns and buying stock in Google. Google could then sell stock to raise money, or take out a loan with its own stock as collateral, to pursue projects with the money. In theory, a good trader lends money to the companies that deserve those resources the most. So, as far as I can tell, it isn't a zero-sum game.
If the entire stock market does its job like this, money gets to googles more easily than it gets to pets.com. The economy uses capital more efficiently, and grows more than it would otherwise.
Of course, that's all in theory. In practice, being an investment banker is rough.