Cows love their grass. They’re naturally a grazing animal. This means that, as they move from patch to patch, they eat the grass that’s there. This keeps the grass in check as it grows, but leaves grass to regrow for other cows as they come through.
With the invention of the closed in farm, fewer cows are being fed a proper diet, but that’s for another question. If the cows are not to be pasture-fed (IE fed grass to sustain them), they often get hay and a mixture of other things to supplement what is missing from the hay. This is considered to be feedlot feeding - where a lot of cows are placed in the same room, given their food, and left to fatten up for consumption by humans.