Well, in the long run we’re all dead. Have another drink.
Your statement above is almost recursive. Both ‘inflation’ and ‘devaluation’ have the same meaning. In this case, it means that one dollar’s worth of value purchases less real wealth.
Remember, money - currency - is in no way wealth. Items, goods are wealth. The phone in my wallet is wealth. The $20 bill in that wallet is simply an accounting measure of potential wealth. A million dollars with nothing to spend it on is valueless.
For the OP’s question? Money has value because we agree it has value. No other reason. Any other stated reason is stuff and nonsense. If you went into a shop and offered to by a widget for $20 and the shopkeeper said he wouldn’t take your bill because he didn’t value it your money would, technically, be worthless there. Your money would no longer have value.
Now, there are some legal issues with that. “Legal tender for all debts, public and private” is written on cash for a reason. It means the government that issued those bills will back up - maybe with force - the value of those bills. But, in truth, any enforcement mechanism is also predicated on a mutual agreement between the people that those bills have value.
Yes, in a really sideways situation a National Guardsman could point a gun at the shopkeeper and force him to take your bill in exchange for what you wish to buy. But that really only works once. Quickly, the shopkeeper and his peers will either shut down or relocate to someplace where such things don’t happen.
As for gold and such? Yes, it has some value for jewelry and electronics. Fine. But nowhere near what it’s currently valued at on the spot market. Over this weekend it’s $1585 per ounce. A ridiculous figure in terms of its basic usefulness.
Because gold is, like the banknote in my wallet, money and not wealth. It’s a reserve of value that is recognized as such only because it is agreed to by many parties. It has addition cache because it has been recognized as such for a long time but it has no more real intrinsic value that a linen banknote or bitcoin, really.