Those foods usually contain lots of calories and when we were still evolving more calories meant a better chance of survival. So, things such as fruits are sweet because our bodies want us to crave them so we'll eat them and consume larger quantities of calories.