I've already answered this at Joshua Engel's answer to What are some good ways to respond to a kid who asks "Why does all the stuff that is bad for you taste so good?"
, so let me take a different approach to it.
Notice that the foods you think of as "bad for you" take decades to kill you. Natural selection isn't exactly all that concerned with stuff that isn't going to kill you until after your reproductive years. Things which are immediately
bad for you, like toxic plants and animals, generally do taste bad. You don't have to be told a second time not to eat, say, poison ivy, or rocks.
Similarly... the problem with "healthy" food is that it's something for which the lack tends to take a long, long time to kill you, and it doesn't take all that much. You need vitamin C to prevent scurvy, for example, but you need only one piece of fruit per day to get all you really need for that, or one to two servings of most vegetables.
You can survive on a lot less food than we get, and that's what your ancestors had pretty much all of the time. [[EDIT: ignore this sentence; see comment below: You can get by with just a few hundred calories and get everything you need.]] We are told to load up our diets with "healthy" food primarily as a way of getting enough without getting too much: you can have as much kale as you can choke down without doing any harm. The same can't be said for modern concentrated foods.
The foods that people think of as "good" and "bad" are all products of modern culture, and have absolutely nothing to do with evolution. The time scales are far, far too short for that.