Fruit evolved to be eaten in order to spread seeds. Eating them usually does not harm the plant.
Eating vegetables usually kills the plant, so they have an evolutionary incentive to discourage us from eating them (toxins). We have lost the ability to digest cellulose like our primate ancestors could, so we’re able to realize very little nutritional value in most vegetables (and we’re breeding them for looks instead of that nutritional value)