Anything generally accepted in exchange for goods and services. It is defined by what it does rather than by what it is made of, and almost every kind of object has served as it at some point.
Money is conventionally defined by three roles, and something qualifies to the extent it performs them.
A medium of exchange, accepted in trade so that goods need not be swapped directly. This solves the problem of the double coincidence of wants, in which barter requires each party to have what the other wants at the same moment.
A unit of account, a common measure in which prices, debts and accounts are expressed. This allows comparison and record-keeping, and it is the function that matters most for contracts.
A store of value, holding purchasing power over time so that selling and buying need not be simultaneous.
The three can come apart. During severe inflation a currency may still be used for transactions while people keep savings in something else and quote prices in a foreign currency, which is money failing at one function and not the others.

Cattle, grain, salt, shells, beads, cloth and metal have all functioned as money. The properties that make something suitable are practical: durability, portability, divisibility, uniformity, limited supply and general acceptability.
Precious metals satisfy most of these, which is why they were adopted widely and independently. Coinage, in which metal is stamped by an authority to certify weight and purity, appeared in Lydia in the seventh century BCE and made metal money usable without weighing at every transaction.

Paper money began as a receipt. A depositor left coin with a trusted holder and received a note, which then circulated in place of the metal because it was more convenient. Song dynasty China issued paper currency from the eleventh century, several centuries before Europe.
Commodity money has value as a commodity independent of its monetary use, such as gold or salt.
Representative money is a claim on a commodity, such as a note redeemable for a fixed weight of gold.

Fiat money has no commodity backing and is not redeemable for anything. It has value because it is generally accepted, because the state requires taxes to be paid in it, and because its supply is limited by the issuer.
Every major currency today is fiat. The transition was completed in 1971 when the United States ended the convertibility of the dollar into gold, ending the Bretton Woods arrangement that had linked other currencies to the dollar.
The tradeoff is straightforward. Commodity standards constrain the issuer, which limits inflation and also prevents the money supply from responding to economic conditions, and the deflation that constraint can cause has its own severe costs. Fiat allows response and requires the issuer to be trusted not to over-issue.
Most money in a modern economy is not issued by the state. It is created by commercial banks when they lend.
When a bank makes a loan it credits the borrower's account, creating a deposit that did not previously exist. That deposit is money, and it is destroyed when the loan is repaid. Physical cash is a small fraction of the total.
Central banks influence this through the interest rate at which they lend to banks, through reserve and capital requirements, and through direct purchases of assets. They do not create most of the money in circulation directly.
Electronic transfer means most money now exists only as records, and the physical form has become a minority of transactions in many countries.
Cryptocurrencies attempt money without a central issuer, using cryptography and a distributed ledger. Their performance against the three functions is uneven: they function as a store of value for some holders and as speculative assets for many, and high volatility limits their use as a unit of account, since prices are rarely quoted in them.
Central bank digital currencies, under development or trial in many countries, are state-issued money in electronic form, closer to conventional currency than to cryptocurrency.
Money is the institution that makes complex specialisation possible. Without a general medium of exchange, every transaction requires a matched pair of wants, and an economy in which people do one job and buy everything else cannot function.
It also illustrates that an institution can rest almost entirely on shared expectation. A banknote is worth what it is because everyone expects everyone else to accept it, and that expectation, rather than any property of the paper, is what is being maintained.