what is bitcoin mining actually doing ?

There are two possibilities for that, mining has been created to make a decentralization system which has been operated by so many computers around the world. So it can't be broken by the regulation.
Too keep the decentralization network of bitcoin but sadly in another part that gives a lot of stress due to the energy consumed to did mining activity. It can't destroy the earth for a long-term plan.