There are two big mysteries in veterinary medicine. I posed these two questions to a thousand or so veterinarians on an internet group I belong to and here is a summary of the answers I received. Dogs like grass. This certainly seems true of some dogs.
Dogs eat grass to make themselves vomit.
It seems in some cases that vomiting is associated with grass eating, for sure, but it is not clear whether the grass eating causes the vomiting, or if dogs who are sick crave grass. And again, a lot of healthy dogs regularly eat grass. Most of the dogs I have seen seem happy to eat things that are anything but fresh. It has to do with the pH of the urine. The lungs and the kidneys work together in repsonse to changes in diet, physical exertion, injury and disease, to keep the internal pH constant.