Hold a paperclip: its mass is about 1 gram. A US nickel is 5 g, a slice of bread is about 30 g, and a full litre bottle of water holds about 1000 g of water, which is 1 kilogram. In a lab, an electronic balance shows mass in grams, often to two decimal places, like 2.35 g.
Mass is not quite the same as weight. Mass is how much matter something has; weight is how hard gravity pulls on it. On the Moon a litre of water would feel much lighter, but its mass would still be 1000 g. Scientists measure mass in grams because it does not change from place to place.
Grams tell you how much, but not how many. 12 g of carbon and 12 g of magnesium have the same mass, but magnesium atoms are about twice as heavy, so the carbon sample holds about twice as many atoms: 1 mole of carbon atoms against about half a mole of magnesium. When a question asks how many particles, or uses a balanced equation, change grams into moles first by dividing by the molar mass, n=m/M.
Think of it like this. Grams are like the weight printed on a bag of candy: they tell you how heavy the bag is, not how many pieces are inside. A bag of big candies and a bag of small ones can weigh the same and hold very different counts. To count, you need the weight of one piece, which molar mass gives you.
Core idea. Grams measure how much matter a sample has, not how many particles it contains. To get from one to the other, divide the grams by the molar mass to find moles.