The various types of economic systems that we know as capitalism are characterised by decentralised decision-making by individual agents under uncertainty and shifting subjective expectations and utilities.
But decisions by a large enough number of people that appear advantageous at the micro level can have negative macro effects.
A perfect analogy is crowd behaviour during stampedes at large events that result in loss of life and injury. Rumour and panic can thrive in large crowds and the macro-effects are disastrous when people are killed or injured in stampedes. From the individual (or micro) perspective it makes sense to leave a crowded event as fast as possible to avoid what might be a treat to your life: when enough people do it the result might not, however, be beneficial to you.
Aggregate variables like investment and macro phenomena like stock markets can be subject to similar problems related to micro versus macro effects. Rumour and panic can cause crashes in financial markets or in investment decisions: negative subjective expectations (with or without rational foundation) can spread to large numbers of business people causing investment and employment to collapse.
Government is akin to the management of a theatre, where theatre managers use their power (through public announcement and their security staff) to prevent disastrous macro events like stampedes. Intervention by theatre management (the analogy to government) to prevent panic and disaster in a theatre (or government stopping secondary deflation and depression in an economy) is a better outcome than allowing large scale micro-behaviour that has terrible macro-effects.
In the case of a slump in investment owing to shocked business expectations, this can take the form of what Keynes called “socialization of investment” (public works and other public spending programs that can be analogous to investment), or increasing people’s spending power to create the demand necessary for increased production.