None of it.
It's probable that it cames progressively (actually more by brutal steps in fact..) into human beings... We Can sée différent steps:
-ability to understand the principles of simple tools... A broken stone cut me so i can use it to cut something
-ability to understand natural effect and try to use them => fire...
-ability to understand the process of death, then remembering the deads and missing them => progressively lead to Funeral rituals
-ability to abstract yourself and others into planning hunt stratégies => developping imagination, strategical manners etc
-ability to believe => all points developped highly... But mostly the power of imagination and self persuasion... Sapiens sapiens (we) is the only human beings believing things that doesn't exist... A bank doesn't exist,it's an imaginary entity, it only exists because people believe it. Same for money, god or superbowl's advertisements...
I'm simplifying. But just saying it doesn't Come from nowhere. We were a prey (australipithecus) that discover tools (homo habilis) , and learnt fire (homo erectus), then developping hunt strategies and Funeral rituals (neenderthalensis) became a predator, and then us... Sapiens sapiens which is caracterized by a higher ability to abstraction, giving a huge importance to imagination. That's why we began to wear jeweleries, doing more developped and abstractive arts, creating spirituality with gods we never Seen, that finally made us able to live in much larger communities (tribal World is clan = big families, few dozens max... You brain still can't know deeply more than a 100 people), those much bigger communities and the ability to imagine and abstract created all what you see around you...
Its not unconscious/subconscious... Those are regulating the machinery... Like breathing automatically etc. It's nothing alike.
Consciousness is the ability to imagine, to reasonnate, to articulate different ideas and create some others etc. Now where does it Come from and how precisely? We don't really know. We just see small parts of fossiles from ancestors and Can only imagine how we arrived there... So there are no real answers. As everything WE don't really know. We like to think ourselves as very smart, but we know nothing jon snow...