Stream of consciousness is a common term for it. Mind wandering and daydreaming are others. More narrowly, self-talk refers to our constructive or negative mental judgments of ourselves. Default mode network, from neurology, names the interacting regions of the brain that kick in when it is not focused elsewhere.
Science and Eastern religion approach the voice in our heads from broadly opposite positions. For psychologists, stream of consciousness is a processing, an internal voicing, of our past and future. Its script is a review and/or a run-through of the words we used or might use in rationalizing, agreeing, or dissenting in our relations with others. To Buddhists, on the other hand, the voice is our ego speaking as it goes about getting distracted, enticed, and entangled by worldly concerns. For the Buddhist, we do well to control it, quiet it, and find release from it.
Quite a range of perspectives. It’s no wonder we read about the marvels of our brain one day and the unhappiness of the wandering mind the next.

(musicpeakperformance.com)
I’m in the middle here. It seems to me that in the course of human evolution, stream of consciousness has come to serve both some useful functions and as a stubborn annoyance. I can roughly gauge the advantages of stream of consciousness by catching the kinds of items in my own stream. It buzzes with flashbacks, flash-forwards, bits of script for conversations, debates and blog posts, short to-do lists, and a mix of sunny and cloudy moods about myself—all of which I can see as beneficial on the whole. But like most people’s, my stream sometimes has serious limitations: it is often inaccurate about what someone else is thinking or feeling, it worries needlessly about things that rarely go wrong, and it obsesses about what is unimportant. On the whole, my stream of consciousness tries to see what’s coming around the corner, but the information it sends me can be narrow and misleading.
A harsher case against stream of consciousness comes from Sam Harris in his spiritual journal Waking Up. We are “continuously spellbound by the conversation we are having with ourselves.” As both the speaker and listener in our heads, we create the illusion of the individual self. Harris adds, “We brood about the past and worry about the future. We continually seek to prop up and defend an egoic self that doesn’t exist.” Still, no matter how we define self, humans like other organisms need a steady flow of information, no matter how imperfect, to monitor the environment and process a complex life. Harris, awake as he is, still writes, lectures, and engages with people.
We live in the remembered past, the immediate present, and the anticipated future, as well as in a wide range of places, here’s and there’s, many of them at the same time to one degree or another. Our senses perceive the here-and-now; our memory and imagination do the rest. A tall order. Stream of consciousness chugs away.