What exactly happens to brain during anesthesia While anesthesia is given to a patient what changes in the chemistry of brain happens. Which part of the brain is affected by the medicine which causes anesthetic effects. 
Can anesthesia be considered as sleep+painless state of body? Or is it more than that.
General anesthesia is a reversible drug-induced neurophysiological state comprised of unconsciousness, amnesia, analgesia, and immobility with maintenance of physiological stability. How anesthetic drugs create the state of general anesthesia is still not completely understood, but general anesthesia is essential for the safe and humane conduct of surgical and invasive diagnostic procedures.[1]

The goals of general anesthesia include amnesia, analgesia, unconsciousness, and immobilization. The ability of general anesthetics to produce these distinct therapeutic endpoints is not equal. For example, explicit memory is the most sensitive target of inhaled general anesthetics; consciousness (assessed by appropriate response to spoken commands) is preserved in the absence of memory during exposure to low doses; and unconsciousness is produced by lower concentrations of most general anesthetics than those that ablate movement in response to noxious stimuli. [2]

General anesthetics consist of many different drugs. [2,3] These different drugs display distinct relative potencies in their ability to produce different components of general anesthesia. For example, the ratio of the drug concentration producing immobility during incision to that producing unconsciousness is 1.5 for nitrous oxide, about 3 for most of the inhaled halogenated ether, and over 4 for the intravenous anesthetic propofol. They also have different effects on EEG during anesthesia. Thus, clinically, general anesthetics can be classified into 3 groups based on their relative potencies for different clinical endpoints and their impact on EEG:

Group 1 consists of etomidate, propofol, methoxital, and barbiturates. These are intravenous drugs that are much more potent at producing unconsciousness than immobilization and shift cortical EEG toward lower frequencies. Their effects are mediated mainly by a subset of γ-aminobutyric acid type A (GABA-A) receptors, which, when activated, reduce neuronal excitation. 

Group 2 includes the gaseous anesthetics nitrous oxide (N2O), xenon (Xe) and cyclopropane, along with an intravenous agent, ketamine. Clinically, these drugs produce significant analgesia, while their potency as hypnotics and immobilizers are relatively weak, and they may increase cortical EEG frequencies. Anesthetic agents in this group have little or no effect on GABA-A receptors, but they instead potently inhibit N-methyl-D-aspartate (NMDA) receptors, which are excitatory cation channels activated by the amino acid glutamate. In addition, agents in this group also inhibit α4β2 neuronal nicotinic acetylcholine receptors, which modulate synaptic release of neurotransmitters.

Group 3 consists of the volatile halogenated anesthetics: halothane, enflurane, isoflurane, sevoflurane, and desflurane. These drugs induce amnesia, hypnosis, and immobility in a predictable manner and reduce the spectral edge frequency of cortical EEG. General anesthetics in this group lack significant selectivity for general anesthetic target molecules. They enhance the function of inhibitory GABA-A and glycine receptors while also activating 2P potassium channels and inhibiting excitatory glutamate receptors and a variety of excitatory cation channels.

Group 1 and Group 3 drugs that act by enhancing GABA-A receptor activity in various neural circuits appear to impair both unconscious and conscious processing, including associative cortex and synchronous integration among multiple cortical areas. Cortical EEG activity shifts toward lower frequencies in the presence of these drugs, and large doses can lead to the total loss of coordinated neural activity (iso-electric EEG). On the other hand, Group 2 drugs such as ketamine and nitrous oxide appear to act by impairing signal filtration to the consciousness, perhaps altering the amounts or intensities of sensory inputs, or by allowing leakage of unconscious signals into conscious processing. This lack of filtering “jams” or overwhelms the consciousness with signals, leading to a “dissociative” state, frequently associated with reports of vivid dreamlike experiences.

Therefore, while being under general anesthesia, the brain is still functioning, but it is functioning differently from when it is awake or sleeping. [4] Neural circuits that are responsible for consciousness, sensation perception, memory, and motor are not functioning as they do when being awake or sleeping. For different general anesthetics, different effects on neruotransmitter receptors and neural circuits are different; thus, various neural circuits in the different areas of the brain are affected differently, and the whole brain will function in different unconscious states even though, outwardly, the anesthetic patients appear to be in similar unconscious states. Also, for different dosages of the same anesthetics, overall neural circuits are affected differently, and the brain in different anesthetic stages will function differently too.

N.B. The above is a simplified answer about the complex actions of general anesthetics. More details can be found in the following references.

References:


Akeju O, Brown EN. Neural oscillations demonstrate that general anesthesia and sedative states are neurophysiologically distinct from sleep. Curr Opin Neurobiol. 2017 Jun; 44: 178–185.
Forman SA, Chin VA. General Anesthetics and Molecular Mechanisms of Unconsciousness. Int Anesthesiol Clin. 2008 Summer; 46(3): 43–53.doi: 10.1097/AIA.0b013e3181755da5
Brown EN, Purdon PL, Van Dort CJ. General Anesthesia and Altered States of Arousal: A Systems Neuroscience Analysis. Annu Rev Neurosci. 2011; 34: 601–628.doi: 10.1146/annurev-neuro-060909-153200
Müller CP, Pum ME, Amato D, Schüttler J, Huston JP, Silva MA.The in vivo neurochemistry of the brain during general anesthesia. J. Neurochem. (2011) 119, 419–446. https://doi.org/10.1111/j.1471-4159.2011.07445.x