I am glad you have recovered from your heart attack. What a frightening experience! I hope you are following your doctor’s instructions to prevent having another heart attack.
The heart attack itself did not cause your cavities. Without seeing you, I am going to guess that your doctor put you on a number of medications and one (or more) of those medications is a blood pressure medication.
Blood pressure medications are notorious for drying out the mouth, making you more susceptible to cavities.
You MUST take your medications, so your mouth care will need to be more involved. You will need to brush and floss two or three times a day. You will need a heavy duty fluoride toothpaste and you will need to be diligent about drinking lots of water.
There are many lifestyle changes that people make after having a major health event. A change in your oral care will be hard at first, but it will become routine- just like eating differently and exercising.