The garden, and I assume the greenhouse, work in the same way. First you have to either buy or find ingredients and/or vegetables. You can get veggies from food stands, inns, a and people's farms. There are also sacks and barrels of veggies in bandit hideouts and such. Ingredients you can get from alchemy shops or the wilds, and also some bandit hideouts too.
To farm them, you activate a spot of fertile soil, and it brings up your inventory. Then you choose what you want to plant there, and plant it. I always just put in 1 thing of whatever it is. It should pop up with a thing saying "item planted" or whatever it says. then you press okay, and rinse and repeat for the other plots.
Not everything can be planted-tomatoes for example, can't. But I know you can plant: Potatoes, wheat, leeks, cabbage, carrots, lavender, blue/red/purple mountain flowers, nightshade, dragon's tongue, snowberries, juniper berries, thistle, white cap, blisterwort, namira's rot
I've never had the greenhouse so there could be more in there that you can plant, and there are undoubtedly others too that I haven't tried planting yet.