To prevent grass from entering in the garden you can use following tips-
1. Add edging to your landscape design. It will create a physical barrier between lawn and vegetable garden.
2. Dig a trench to create soil-free space between lawn and edging. It won't allow grass seeds to enter your garden.
3. If edging and trenching techniques are not showing results, use mulch to create physical barrier between lawn and garden.
4. Mowing is the best option to prevent grassroots to enter your garden. Mow the lawn around the age and save your garden from grassroots.