Since the idea that, generally, vegetables are good for people predates modern science, I found myself wondering when and how that idea came to be.
Was it lucky guess, that just gained momentum and has been supported by today's science? Or was there early, simple evidence?
Your question contains an assumption I do not think is necessarily the case, that is to say that vegetables have always been assumed to be "good for people".
People's diets have long been based largely on what is available and affordable, rather than what is healthy. For most people for most of the time, this has meant a diet largely consisting of plant matter and products the are derived from plants e.g. bread or beer, meat being more inaccessible and the province of the wealthy. For example, an 16th century farmer in England would consume a lot of bread, beer, vegetables of grown in a kitchen garden, and fruit harvested and preserved throughout the year. On top of this would be dairy products, eggs and some animal protein from animals raised or fish caught. However, meat raised was an important source of income whether it was pork, beef, or fish, so plant matter was always the main source of everyday calories.
While this is not my field, my understanding is that nutrition has been poorly understood for most of human history until the late 18th century when people began to test connections between the consumption of certain foods and health. That is to say, while people believed that diet had a role in scurvy (too much of something, rather than too little), it wasn't until the late 18th century that citrus fruit was regularly given to sailors to prevent and cure it.
Similarly, while gout has been associated with wealthy people for thousands of years, and a loose connection with the diet of wealthy people (meat and booze) had been believed, the connection with specific types of foods was not established until the 19th century.
This suggests that while I cannot give you an exact answer on when vegetables were established as "healthy" (if such a judgment can be made with respect to other foods, many of which can form part of a healthy diet), that your assumption is wrong. While people did notice that certain diets seemed to result in certain outcomes, this was not connected with vegetables as a group and the consumption (or non-consumption) of any "food group" (in the modern parlance) of foods was not connected actionably with specific ailments until the 19th century.
Asking the important questions my friend.