First things first, not all blockchains have mining. Most public ones have some form of mining because there is not trust on the network. If you have a private or federated blockchain, you can create an alternative consensus algorithm (e.g., voting among the participants) to validate transactions.
Now what is mining? Mining is the process of adding transaction records to Bitcoin’s official public ledger of past transactions. The computers on the network need to come together to decide which transactions in the past 10 minutes should be added to the official public ledger. The network can't just choose one random node (i.e., computer) to tell us how it should be because if that node is a malicious actor, it can make up transactions for personal gain. So how does it choose who gets to propose the newest ledger? Through mining.
Now you have all these computers out there mining. Originally it was predominantly computers and laptops in people's houses. Now, it's server farms 30x the size of Google. And they're all competing through brute force to solve a complex math problem. The formula includes a hash or representation of the previous block, a root of the current transactions to be added, and a nonce (random number) that must equal a number less than .0000000000xx (actual target area was 1/10^20 as of 2014). If they solve the math problem, they are then allowed to propose the next block of transactions and as a reward, it is allowed to issue itself 12.5 bitcoins. This reward incentivizes the winner to only propose legitimate transactions because if they propose faulty ones, everyone else will reject it and they'll wait for someone else to solve the problem and propose an honest ledger.
Now because of this reward, we have seen significant improvements in chip manufacturing and server farms optimized to solve these math problems. We're also seeing domination of the market by Chinese firms that have allegedly partnered with the government for cheaper electricity to lower costs. Interesting as well to see some of the Nordic and colder countries participating and using the additional heat to warm up houses and large buildings.