Depends what anaesthetic was being used. It's often a mixture of benzodiazepine + opioid, plus an inhaled drug like sevoflurane, or an steady IV of propofol. Ketamine maybe too. Varies between countries and anaesthesiologists and procedures. The benzodiazepine makes you relaxed and allows a deeper unconsciousness from the opioid, which greatly reduces your experience of pain. Sevoflurane, nitrous, ketamine, these are NMDA antagonists and can block the pain so completely that you don't even feel it, but are unreliable at keeping someone unconscious and calm, so a mixture is required for operations.
What would be going on your brain - depends what anaesthetic mix and how much of it.
Would it fuck with your brain - only if you had a failed attempt and lost oxygen to your brain. They are basically harmless as drugs, except when used frequently. If used as the sole agent in overdose, anaesthetic drugs alone are highly likely to not lead to a successful suicide, except IV mixtures including opioids. With benzos, ketamine, and most of them, you can take as much as you like and you will not die, just damage yourself.