Why are people so pessimistic?

Why are some people so negative towards everything in life? What sorts of events lead them to be this way? Positivity leads to a better or happier life and everyone knows that but still ignore the fact and remain pessimistic.