Written by Max Hinchman
Double spending is a problem whereby a unit of currency is spent twice. In the traditional world this problem is alleviated by trusting a central entity, if you spend $5 on a coffee your bank ensures that you cannot go and spend that same money on something else.
However, in decentralized systems that doesn't exist so when a node broadcasts a transaction, the network waits for it to be confirmed by a miner. Once confirmed it is added to the longest chain, which the network will accept as the valid record of transactions. Each transaction also includes a timestamp of when it was published as well as the prior transaction hash so every node knows when a unit was spent. Double spending occurs if a miner is able to gain 51% of the hash power. They can then spend their digital currency in exchange for something and then reverse that transaction by creating a longer chain without it, returning their original funds.
This is known as a 51% attack and is typically performed on an exchange as an attacker can send funds to an exchange to purchase another cryptoasset and then reverse the original transaction.
Double-Spending Explained by Bisade Asolo
What is Double Spending & How Does Bitcoin Handle It? by Sudhir Khatwani