Have you ever had a near death experience? What happened?
About 25 years ago when I was still in college I thought it would be cool to get a motorcycle. I rode it around for about a year with no problems until one day I was riding down this mountain road near where I lived and a deer ran out in front of my bike and I swerved to avoid it, I flew off my bike and into a ditch on the side of the road and was knocked out, my bike fell off the other side of the road and down a sheer cliff face. It was not obvious anyone has ever been there or that there was an accident. I laid there for almost a two days until people started looking for me after missing work. When I came to my legs were messed up, I had broken an ankle, elbow and wrist and couldn't move. I sat there for hours convinced I was going to die. I was pretty upset about it but after a while the anxiety washed away and I just went completely numb. My next memory was waking up in a hospital.
Heart stopped beating. I could feel the lack of oxygen despite breathing like mad. Thought "Fuck, tomorrow my mom is going to find me dead in my bed" (I still was a student living close enough to university to commute). Luckily, one of the built-in safety mechanisms kicked in and my heart restarted. Spent some weeks in hospital after that so they could find me a better medication than the one I was using.
Heart attacks are also not no more beating, if you didn't know that. It's when the heart muscles don't get enough blood and the essentially start to suffocate.
If it stops beating for any of a large number of reasons, that's cardiac arrest, which used to be the definition of death.
Cardiac arrest is heart stop beating (e.g. damar Hamlin? The Bills dude the other year). This is when you see a flatline.
Heart attack or myocardial infarction means the arteries that keep your heart oxygenated get blocked, cardiac tissue after the blockage of that then starts dying. The heart is still beating (or trying to beat).
That is a thing if the medication you get does not really work out for you. I remember waking up one night a week before that where I started the blood pressure recorder, and it measured a heartbeat of 26 BPM. And that was when I was actually out of the valley and had enough energy to press the button.