For the last few years I have sprayed a chemical to kill grass and weeds, in an area that I now want to plant a small garden. Do the chemicals stay in the dirt? Is it safe to plant?
I don't think anyone can answer this question unless you tell us what "chemical" you sprayed. Perhaps the most common is Round-Up, and if that's what you used, you have no problem; go ahead and plant.
If what you sprayed was roundup and 24D you will be fine. If you sprayed atrazine, Tordon(Picloram) or other such things you may have a problem. It is more than likely that you sprayed the first two things as they are what is commonly sold at home improvement stores.