Once you unlock DIY with Tom Nook, you can craft things using materials that you find on your island. Here is how to gather those materials.
Get an Axe and/or a Shovel
To gather materials, you will need a flimy axe or stone axe for trees and bamboo, and a shovel or any type of axe for rocks. You can buy a flimsy axe from Timmy in the Residential Services tent, or you can build one with the recipe that you get from Tom Nook by donating creatures to him. (Read the tools page for more information about tools.)
Don't Eat Fruit Before Gathering from Rocks
If you want to gather materials from rocks, don't eat fruit. Eating fruit will make you break a rock if you hit it with tools.
Hit Rocks, Trees, and Bamboo
Use a flimsy axe or stone axe to hit trees, and use any axe or shovel to hit rocks. This will make things like clay, iron, stone, and (in rare cases) gold nuggets come out of rocks, and will make softwood, wood, and hardwood come out of trees. You can hit bamboo trees to make bamboo and young spring bamboo come out. You can then use these materials in DIY crafting projects.
Gathering Limits
You can hit trees and rocks multiple times, to get multiple materials from each one, but there are limits to how many materials can come out per day.
You can get three pieces of wood/bamboo from each tree per day.
You can get up to eight materials from rocks per day, but you need to gather quickly to get all eight, because there is a time limit to how long you can gather materials from that rock after the first time that you hit it. You will need to walk back toward the rock before hitting it again, or, if you have a shovel, you can dig a row of holes behind you, to stop you from getting knocked too far back each time you hit the rock. Or if there is a natural wall, or water edge, next to the rock, you can stand between it and the rock.
Bell Rock
One rock per day on your island will be the "Bell rock", which means that when you hit it with a shovel or axe, Bells will come out, instead of materials. Be sure to gather quickly, as mentioned in the previous paragraph, to try to get the maximum number of bells.
Gathering More Per Day
You can only get materials from rocks and trees once per day, so if you need more materials after that, you will need to use Nook Miles Tickets to visit random islands. You can gather materials from the trees and rocks of every random island that you visit.
I Broke a Rock!
If you break rocks on your island because of eating fruit before hitting them, new rocks will appear in random locations on your island the next day to replace the ones that you broke.