Mining is for security. When someone make a transaction, that transaction is relayed to every node in the bitcoin network, wich takes only some seconds. But it is still an unconfirmed transaction. To become confirmed it must be put in a block by a miner. The blockchain is the backbone of the bitcoin system, it is where all transactions are recorded and it is how bitcoin make sure no one can counterfeit bitcoins or double spend them. Why? Because modifying the blockchain is almost impossible, due to how blocks are created. It takes a lot of computing power to find one wich follow the bitcoin rules, and that's what miners do, find blocks and put transactions into them, making the bitcoin network secure