I started to post this under "internal medicine", but it's in the right place. Dogs (in fact, all domestic animals) very rarely have a heart attack in the sense that we understand it in human medicine.
Myocardial infarction (M.I.) is the technical term for "heart attack". Myocardium means heart muscle. Infarction means that the blood supply to something is stopped up, causing damage to whatever has lost its circulation. Sometimes people say they've "had a coronary". The coronary arteries are the blood vessels that bring oxygen and nutrition to the heart muscle so that it can do its job. If one of those arteries gets stopped up, the heart muscle it was taking care of gets really sick, really fast. Maybe it just dies. If a big enough area of heart muscle is affected, the heart ceases to function and you die. With very small areas of heart muscle damaged, your heart may keep working, but you have chest pain, nausea and all the rest of the signs of a heart attack.
The most common cause of a blockage in these coronary arteries is the build-up of atherosclerotic plaque. Cholesterol (among other things) builds up a lining of crud inside the blood vessel, making it's interior diameter smaller and smaller. This in itself causes poor blood supply to the heart muscle. If a chunk of the crud breaks off, it flows downstream and can cork the vessel off completely. Now you're having a heart attack.
The thing is, it's rare for domestic animals to have high cholesterol. There are definitely individual animals that do have high cholesterol and triglycerides (another kind of fat in the blood). They usually have thyroid problems or other medical problems that contribute to this. Even when they do have high cholesterol, they don't develop the atherosclerotic plaque that would clog up their coronary arteries. Maybe they just don't live long enough for that to happen. Even really obese human children don't develop that kind of heart problem before they are teenagers. At any rate, dogs and cats and horses and cows do not have coronary arteries clogged up with junk. This means that they very rarely have something that stops up an artery to cause death of the heart muscle. If they do, it would be a blood clot or something similar.
What all that boils down to is that, with rare exceptions, dogs don't have heart attacks. Whenever I have a patient that dies suddenly with no explanation, we encourage a post-mortem examination. If nothing shows up to the naked eye, we send tissues (pieces of the organs) to the pathologist to examine under the microscope. With a sudden death case, we always send the entire heart. Myocardial infarction has been reported back to me exactly one time in twenty-eight years. It can happen, but it doesn't happen very often.
So why do people tell you that their pet died from a heart attack? Where did they get such an idea? Sometimes they just invent it. You extrapolate your answers from what you know. Why do people die suddenly? Heart attacks. Why wouldn't a dog be the same? See the above.
I'm afraid that, in years past, most people have heard the pet-heart-attack story from a lazy veterinarian. Think about it: people have experience with heart attacks. They don't have much understanding of other types of heart problems. If the pet didn't die from a heart attack, what did cause the sudden death? If you (as a doctor) were presented with a pet who died suddenly and you could not determine the cause, which would you rather do? 1. Give a lengthy explanation of why it's probably not a heart attack (see above) and end by saying that you don't have a clue, OR 2. Solemnly pronounce that the pet died of a heart attack.
Two good things here: the first is that our pets are unlikely to have a heart attack. The second is that most veterinarians won't give you that kind of a BS answer these days. Would you rather have an earnest "I don't know" or a solemn load of BS? Would "I don't know" satisfy you? See comments below.