Games are, as the article puts it, frivolous toys, and the second-by-second stock market is a zero sum game casino. (Buying stocks is emphatically not investing in a company, except tangentially. It is principally a speculation on the price of an asset, and no money actually goes to the company when you buy stock through a broker).
In fact, they both do have some economic outputs, although their value is quite hard to measure:
Games are entertainment. They provide escapism and fun when we are bored or sad. This improves our wellbeing.
The stock market's output is difficult to see, but it is there: they compute the value of stock. Why we need to know the value of stock to such fine resolution in time, I do not know. But we're spending all those quants' brains finding it.