Before the invention of fiat currencies, people used to trade necessities and goods; for instance, a farmer could trade his carrots for the fisherman’s fish. However, barter trading is not appropriate for all types of transactions - for instance, a single cow may be worth 30 chickens, but you couldn’t split the cow into 30 pieces and expect it to still be alive.
In order to facilitate this, fiat currencies were invented to replace and improve upon barter trading; by using precious metals as coins, we could represent the value of any given good in an abstract manner and use the coins to transact instead. Instead of a single cow being worth 30 chickens, a single cow was worth 10 coins, and each coin was worth 3 chickens!
Initially, coins held value based on the underlying value of the precious metal that was used to mint it. As there was a limited amount of the precious metal available, it was highly desirable to hold onto these metals as it was difficult to mine / process them out from the ground.
In a similar fashion, cryptocurrencies and Bitcoin hold value because they are used as a store of value, medium of transfer as well as the perfect currency alternative to centralized systems. Bitcoin for example has a limited supply that is codified in its issuance; no more than 21 million Bitcoin can ever be issued, and any increase to the current circulating supply is being “mined” at an extremely slow rate.
Fun Fact: today’s centralized currency systems are often criticized as being an over-abstraction of the barter trading concept, as they no longer use precious metals of limited quantity but rather low-value paper notes that can be printed infinitely to represent a country’s sovereign currency. Countries that use central banking systems will determine the amount of money in circulation according to how it wants to influence the economy in certain ways; this means that the absolute power to determine the value of a currency lies with the government rather than with the nature of the currency. This was one of the many reasons Satoshi Nakamoto invented Bitcoin!