Emergent property through evolutionary selection, do you not believe in evolution?
If the brain is just processing things in complete chaos an animal would be completely useless, but with a part/thread dedicated to processing inputs and checking memory I think it is very obvious this function of consciousness would emerge through natural evolution.