Can investing help with the cost of living crisis?

How, and why, does investing help you achieve financial stability in a time of energy crisis and inflation?