The practice of digitally adding transaction records to the blockchain, which is a publicly distributed database that holds the history of every bitcoin transaction, is known as bitcoin mining.
Mining is a data-keeping activity that requires a lot of processing power. To guarantee the payment network is trustworthy and secure, each Bitcoin miner across the globe contributes to a decentralized peer-to-peer network.
Bitcoin mining machines perform complicated mathematical problems in order to safely contribute to the blockchain record. When a solution is discovered, the most recent block of verified transactions is added to the blockchain as the next link.
The miner that solves the challenge is rewarded with a block of Bitcoin as an incentive to mine and contribute to the network.
Reference:
https://xtrading.com/financial-questions/what-is-bitcoin-mining-and-how-does-it-work/