Useful from the point of view of helping an animal satisfy its needs, so allowed to survive by natural selection? Perhaps it's just a inevitable by-product of certain types of thought.
That's assuming an animal is a thing that wants things. Again, not unreasonable, but also not actually an empirical statement, when you look critically at it. You're just pushing the teleology up a level.
At some level it's just trying to survive because trying to survive is what helped all its ancestors to actually survive. It doesn't even need to be expressed as a "want", since plants are doing the same thing without a nervous system, going through a sequence of actions programmed in DNA and expressed in a chain of extremely complex biochemical reactions.