Investing in a company puts your money in a non-inflationary asset. If inflation goes up, your land, machinery, buildings, raw materials as well as finished product just jumped in numbers of dollars of value, thus holding its real value. The same can be said of any hard asset, and dollars could also be switched with any country’s currency. I like large index funds because they are largely diverse. There are big swings, but I have gotten 9-12% average, over long periods of time.
Inflation is similar to a stock split. If you can understand stock splits, you have a rudimentary understanding of inflation.
Here is some extra information that may be too much info: Add in population growth, and realize how money supply has to at least increase to keep pace, for every worker to maintain the same pay. (in theory) Some nation’s citizens like the relative stability of the dollar’s value, and trade or have savings hedged with dollars. These dollars essentially drops out of money supply. Their trade velocity drops for these dollars. There are so many variables, that economists look at inflation measures to see how they are doing. These indicators are always 6 months or so behind, so they are always flying by only being able to look behind their plane.