You have to buy a mining laser first & also a refinery.
After you have those, you fly to a system with a planet that has a metallic ring & start mining.
(Bhotho is a good start)
Just point your ship at an asteroid & shoot it with the mining laser, small chunks will float off & you pick them up with your cargo scoop & the refinery will turn them into loot.
note:
You will need to manually move new refined items to a slot, after that they get added automatically & when 100% is aquired it gets added to your cargo hold.