Press the M key to select the mine tool and highlight the area of which you want your miner to mine. This only works on asteroids. You must have at least one miner, preferably three stars or higher. Mining is usually the second thing to do after making an airlock and life support area.
To gain matter from mining, you need a refinery. This is where asteroid chunks are converted into matter.