After your heart stops pumping blood throughout your body then your brain gets starved for that oxygen rich blood.
When your brain does not get the needed blood flow that has oxygen in it then the brain cells begin to die within a few minutes.
Your brain usually stays active for 3 to 6 minutes after your heart stops so it's very important to get someone's heart restarted as soon as possible after they've had a heart attack or whenever there heart stops so as to avoid brain death or brain damage should the person survive.