why we use mining.
In a decentralized currency the transactions has to be stored in a ledger that is immutable (something that won't change). That ledger is called the blockchain (a chain of blocks). In this chain, each block is linked to its previous block and it is timestamped and produced by performing a certain type of "work" on it referred to as "mining". This work is performed using computing power and it is computationally expensive based on the network's target.
The cost of mining accompanied by the fact that the nodes follow the chain with the most work makes tampering with the ledger expensive hence provides immutability.