There is no single point in evolutionary history where consciousness could be said to have suddenly come into existence. Within species it exists on a continuum.
A starfish can move without a brain. Its cells act together instinctually, with chemical signals firing between them. But it moves in slow motion, and its awareness of the surroundings is primitive. Worms were the first life-form to develop a simple central nervous system, where all the cells within the organism were commanded by one location, a precursor to the brain. It was a major step in the evolution of consciousness, an essential evolutionary step in allowing you to sit here reading this today.
For the brain's evolution to become a truly effective adaptation it needed to know what was happening around it. And so various cells within the body began to develop more sensitivity to external stimuli, like light and vibrations. It's through these gates of the senses that the brain gathers information about the external world.
Through these senses the brain reconstructs a subjective view of reality. But the mind's representation isn't an accurate representation of reality itself. We turn a small segment of the light spectrum into color (most we can't see), vibrations of air into sound (most we can't hear), chemicals into smells, etc, but those things don't have the same nature as we see them outside of our minds. Instead they exist as different types of energy in various forms. So our brain's evolution hasn't given us the ability to witness reality in its ultimate sense. Different species evolved their own specialized tools for navigating their environments. Snakes may see the world through heat waves. Sharks and stingrays can hunt with bio-electrical energy. Bats & dolphins navigate with echo-location. So "reality" to species that have senses we lack can appear vastly different.
The Evolution of Emotion
Take a good look at other mammals, the class of species to which we belong. These creatures have evolved along side of us, and hence possess a consciousness in many ways similar to our own. They may lack our ability for complex language and analytical thought, but each of them are nonetheless sentient. Although we have a much larger Cerebral cortex, the major components of the brain are common to all mammals. Many are also capable of feeling some of the same emotions as we do. The parts of mammals brains most responsible for emotion, the limbic and nervous systems, were largely inherited from a common ancestor. Have you seen other mammals, whether wild or a pet, express some emotions that almost seem human? Perhaps a dog that lights us with excitement when his owner comes home? Other mammals can express joy, sadness, and many more complex emotions in between. But due to our unique position at the apex of the food chain, for wild animals the emotion that we often seem to invoke in them is fear.
Emotions such as fear evolved for good reason, to guide behavior at an instinctual level. In terms of natural selection, the fight or flight response was an important adaptation. Anxiety can be an early warning to a potential threat. Fear can set off a rush of adrenaline. Anger can act as a biological drive to guard territory, a mate, or offspring. These instincts are still encoded within us today. While for some of us they remain at levels more prominent than necessary for the expectations of a modern world, they evolved ultimately to aid in our survival.
As mammals increasingly became pack creatures, they came to depend more upon their emotions to guide them. Whether for hunting or for defense, it required mutual cooperation. These communal animals needed to be able to express and read emotions of others in the group. And so emotion came to be expressed through body language and sound. Being able to share emotion in this way was a primitive form of communication that helped serve these goals. Within primates (the order of species to which we belong) this sensitivity to the psychological state of others allowed the formation of complex social hierarchies. And evolving in tandem with this was a new range of facial expressions to help with social adaptation. The breadth of which approaches the range that humans are now capable of.
The Evolution of Intelligence
While the main components of our brains are shared by other vertebrates, what sets Homo sapiens apart as a species is our enlarged Cerebral cortex. Composed of a dense network of interconnected neurons, the Cerebral cortex evolved as an extension of the brain-stem (reptilian brain). It's the large, densely folded region that most of us consider to simply be "the brain". This outermost layer in the brain's evolution gave mammals more ability to think, learn and communicate.
In general the intelligence of animals can be approximated by their brain size and by their brain-to-body mass ratio. Larger species need larger brains to control and regulate their bodies, so a larger brain alone doesn't equate to greater intelligence. Within our hominid ancestors the brain is thought to have grown substantially as a result of becoming bipedal, allowing us to support the additional weight of an enlarged skull directly above the spine.
Another important factor in the human brain's evolution was a change in our ancestor's diets. As a result of savanas replacing forests, and the new use of tools for hunting, hominids began eating greater quantities of meat. This provided an increase in protein, an essential ingredient in brain development. And because we were eating less vegetation, and since tools now replaced our bite as weapons, the large primate jaws and the strong muscles connecting them to the top of the skull became unnecessary. After a mutation in our jaw cells muscles occurred, significantly weakening them, the brain cavity was able to further expand. The brain's evolution of a larger Cerebral cortex provided the foundation for the next major leap in consciousness, the birth of symbolic language.