People are often confused by the difference between brain death and comas.
The definition of brain death is that the entire brain has irreversibly lost all function. Everyone who dies, ultimately dies of brain death even if they didn't suffer a direct injury to the brain. For example, when people die from heart attacks, the real problem is that their brain isn't getting oxygen, which is why knowing CPR can make all the difference.
The main difference is that people who are in a coma haven't lost all brain function. That is, they still have some level of measurable brain activity and their brains are still sending out electrical impulses in response to stimulus.
For example, people in a coma may still have a gag reflex, but people suffering from brain death don't. And even those people who are in a really deep coma have enough brain voltage to show up on an EEG, a test so sensitive it can pick up the static electricity on clothes.