A heart attack is a sudden event where blood flow to the heart is blocked, while heart failure is a chronic condition that develops over time due to the heart's inability to pump blood efficiently. A heart attack can increase the risk of developing heart failure over time.