Plant-eaters have to get all their food from the plants they eat. So how much nourishment they get depends on what is in the plant. This not only varies from plant to plant, but from one time of the year to another. You might be able to see this most easily if you think about a modern farm. Farmers grow grass, but the grass slows down its growth as the colder months arrive and may stop growing altogether. You will notice this in your garden, for, as autumn approaches, the grass needs mowing less often. But it is not just growing, in autumn, grass contains less nourishment for animals. The opposite is true in spring and early summer when farmers cut hay when grass is growing fastest and it is also at its most nutritious. Farmers then store this grass (as hay or silage) until the winter and feed it to the animals when they cannot find anything in the fields.
Now think about plant-eating dinosaurs. They have no one to store food for themselves, so they cannot live in places where the plants stop growing. Dinosaurs lived in warm parts of the world, mostly in the kind of places we would call savannas today.
But plants were not the same in dinosaur times as they are today. There was no grass. There were only evergreen conifer type trees and ferns. So dinosaurs were mainly browsers of trees and tree-ferns. But these plants were not as nutritious as the plants of modern times. This gave dinosaurs a problem. They had to get nourishment from poor plants. They did this by keeping the plants they had chewed inside their guts until as much as possible had been dissolved out. In turn, they did this by having big stomachs and big guts (intestines).
Now you know why plant-eaters were huge. The bigger your guts, the more you can extract from poor plants. Look at elephants, who browse on poor savanna plants today.
But being huge had another advantage. I meant that many were simply too big to be tackled by hunters. So the hunters only got their chances with young plant eaters (which were, of course, much smaller) and old plant-eaters who could not defend themselves with a swipe of their whip-like tails.