There are two different things people mean by this, so here is both.
Open the Map from inside your room and look for the additional room tabs. You can purchase a yard in a few different sizes, then decorate it from the W-shop with plants, a fence, a bench, trees, a fountain, a pool or a hot tub your pet can actually climb into. Fake plants are the low-maintenance option, since they never need watering.
If you want to actually harvest food, buy a yard first, then head to the Gardening section of the W-shop and pick up seeds. Read the packet, because each type yields a different quantity. Drag the seeds into your yard, confirm, then use the Walk button and click each plant to start gardening.
Rake and water every single day. Miss a day and the plants die. Keep it up and you will have carrots and other vegetables to harvest and feed to your pet. The gardening book in the W-shop explains the full cycle if you want the details in one place.