All Ornithischian (bird hipped) dinosaurs were herbivores (vegetarian).
Saurischian (lizard hipped) dinosaurs called Theropods were mostly meat eaters. Some were scavengers, some were hunters, some ate other dinosaurs and some ate small animals and insects. The really big Saurischian dinosaurs called Sauropods, such as Apatosaurus and Diplodocus were vegetarians that browsed on trees and shrubs.
How do we know this?
Dinosaur teeth are the biggest clue.
Meat eaters tend to have sharp pointed teeth for stabbing and ripping flesh. They also tend to have sharp claws for attacking their prey.
Herbivores tend to have teeth for ripping leaves from branches and grinding vegetation.