As a starter, if you have a healthy brain, you're not going to be able to stick your hand on a piping hot stove, drown yourself, starve yourself when your know there's food, hold in your digestive function, the list goes on. What's stopping you from doing all these things? The simplified answer is inhibitory neurons that care more about your survival than your intellectual self does.
When a species adapts such that they don't have to work as hard for survival, attention is reflected inward, noise becomes more significant, the random stream of consciousness begins to randomly manifest itself. Every once in a while (in the history of billions of human beings) the random thoughts add up to something significant in the environment that was previously observed, but not understood, and through social mechanisms, the organisms are able to convey the information and hold on to it and teach it to their young. As the young learns new information, it changes their behavior: the experience of pain deters you from repeating painful actions. Temptation towards available pleasure is often irresistible unless the greater consequences are fully realized. Many human actions are nothing more than reactions to emotional experiences which are indicators of survivability. Of course, when an organism is bored (no pleasure available or pain warning of threats to survival) then returns the random noise, based on past observations that we can somehow, by chance, make sense out of. But usually not.