Mining is the process by which cryptocurrency transactions are verified. The process got its name from the fact that once a block is verified, whoever solves the block will earn some coins as a reward. The hard work involved and the gold coin reward analogy led to it being called mining.
When Bitcoin was launched, the idea was for every participating node to be a mining node as well. Nodes would send, receive, verify transactions and attempt to solve new blocks through mining. As GPU and ASIC miners made CPU mining unprofitable, the mining feature was disabled by default in later versions of the Bitcoin Core software. Admittedly, Satoshi's original intentions were much more democratic and decentralized than today's mining infrastructure.
When you wish to send Bitcoin to someone, you compose a special structure called a transaction. A transaction contains the source of the Bitcoins, the target of the transaction or where you're sending coins to, then all this is digitally signed by your private key. The result is an independent structure that is broadcast onto the network. This broadcast happens in a P2P fashion - your node looks for other people running Bitcoin around you and sends a copy of the data out to each peer.
After receiving transactions, peers store them on temporary space. This can be either RAM memory or disk and depends on the implementation. Miners will then receive this transaction the same way other nodes received it, via the P2P network and they will decide to include the transaction or not based on the fee offered in the transaction. Remember that, when sending BTC transactions, you choose how much to include as a fee for miners. Higher fees make the transaction get chosen over those with lower fees. Miners will choose transactions until the total data adds up to about 1MB. When 1MB is reached, miners will call this a block and it begins to get mined. Pools generate the Merkle Root for this newly formed block and start sending work to miners.
Once mined, the block is forever committed onto the blockchain and the transaction is said to be confirmed. Each new block that gets added after it is called a new confirmation. This is because the longer the blockchain, the less probable it is for anyone to have been able to defraud it. It is usually good practice to wait for 6 confirmations to consider a transaction permanent. At a 10 minute per block rate, this means waiting approximately 1 hour to make sure the transaction is definitive.
We hope to have highlighted the importance of mining and the basics of how it works. The way Bitcoin reaches consensus in a completely decentralized way, without anyone in control, is simply revolutionary. To understand mining means to understand how this fascinating system works.