This is quite normal during a child’s development as they begin to get a greater sense of self. Remember that they are a separate entity from yourself and have their own likes and dislikes. And the fact that fruit and candy doesn’t taste quite as delicious as broccolli and other vegtables doesn’t help.
Another problem is with parents feeding young children alot of sugary/fatty and processed foods while they are young. Remain away from grocery ilses and restaurants that serve that kind of food. And keep that junk out of your house, it’s not only good for your child but for yourself as well.
In addition, other family members may add to this chaos. Explain to your spouse, parents, and the other members of your family that you want them to restrict what they feed and offer your child.
If it’s available and your child is hungry, they will eat it, even if it’s only vegtables. Find out what vegtables they like. Use healthy dips and dressing etc, because even I am not the biggest fan when it comes to straight up veg, but vegtables make up a considerable amount of my food.
You could also use the Premack Principle - the opportunity to engage in a high probably response (dessert/TV) will reinforce a low probable response (eating your veggies). But this is based on the condition that they aren’t satiated fromt the rest of their meal first, and that watching TV/etc is more probable,… but working with a two year old in this manner may be quite difficult But it can be easily done in 4-5yr olds.
Just see what you can do. Good luck!