Okay I'm back, now where to start...
I can go into the why & how of associative learning but I assume you already know the brain is mechanistic (it can be affected by drugs/electrodes/alcohol, there's no arguing that the mind is embodied) and what you're specifically referring to is self awareness and the notion of Qualia.
Self awareness is easy its a self regulatory feedback loop, your internal dialogue is the speech part of your brain sending its output directly to the auditory recognition part so instead of saying something stupid only to immediately wish you didn't instead you hear yourself internally and can assess what you're going to say before you say it.
The principle is simple enough but replicating it in a digital AI is a real challenge, a feedback loop is an inherently temperamental thing and having one embedded in a highly adaptable associative learning system is a recipe for disaster. To prevent the feedback loop from going out of control you either end up crippling the associative learning part or you reduce the effect of the feedback loop to practical irrelevance, but somehow the brain has made it word we just don't know what the exact mechanism is yet.
As for qualia well it's like asking about the meaning of life, question itself is wrong, an inherent meaning of life is impossible because meaning itself is subjective, likewise it doesn't matter if the red I see is the same as the red you see because if there is absolutely no way of knowing then it's entirely subjective, your neural net has mapped out the concept of red in a different way to mine but so what? It's still red no matter what it looks like to you.
I dunno does this help?
The idea that the mind is not mechanistic is so alien to me I don't really know where to begin explaining it to you.