I believe if you want to truly delve into the origins of the craving for nutrition high in sugar and fat is because of their extremely high energy content. As a hunter gatherer society, these nutrition sources would have been invaluable for our survival so we evolutionarily developed a taste for them. I suppose this taste was so powerful that its managed to persist through to the modern age and became an ingrained part of our culture and society. Then they became abundant, cheap, massive and of relatively poor quality, the rest is fat history