Congested heart failure is heart that doesn't have the heart muscle contractility enough to pump an adequate supply of blood into the system. As a result the blood received from the lungs to be pumped out into circulation backs up into the lungs and fluids leak into the lung tissues (that is the congested part). Heart failure doesn't necessarily mean lung edema. Heart failure can cause chest pain, shortness of breath, muscle fatigue, etc.
A heart attack medically referred to as an MI causes heart muscle to die (necrosis). Necrosis impairs heart muscle contractions causing heart failure.
Necrosis can be the result of lack of blood flow to portions of the heart caused by plaque blocking blood flow and clots. Also, heart muscle damage can be caused by disease that thickens and stiffens heart walls reducing effective contractions, reducing filling capacity and a disorder of the valves can reduce cardiac output causing the heart to dilate to compensate and that will eventually effect pumping contractions to be weak.