Heart attacks are the most common cause of heart failure.
If you have a heart attack one of the arteries supplying your heart muscle itself has become completely blocked, cutting off the blood supply. This means that oxygen and nourishment can't get to that part of your heart muscle, causing it to die. Your remaining healthy heart muscle then has to pump harder to compensate, putting more workload onto your heart than it can handle. This can lead to heart failure (over several months or years).
|Animation explaining how a heart attack can cause heart failure|