Haven't had this happen to me but have heard of it before. It can affect them either way - for the better or for the worse. For most it has to do with suddenly facing their own mortality in a very real, scary way. That can effect them deeply.
Some think that they have no more time to waste living an "average life" and go off the rails. Doing things they never would have before, because they aren't sure that they have time to experience "real life" before its too late. Like why save for the future if you are not sure you have one?
Some are so grateful for the second chance they go all out to make amends for things that they believe they have done wrong, again before its too late. Hoping to make the life ahead better than what happened before.
Some are so grateful to be alive they make the most of it by loving those that love them, being grateful for that opportunity.
Very few suffer from oxygen loss during the heart attack or the operation, or suffer a stroke as well as the heart attack, and suffer through a personality change due to brain injury.
It could be your husband had something going on before the heart attack that you were unaware of, even before this.Something that he no longer cares to hide anymore. It could be someone else or it could be a gambling addiction, or something else entirely.
TALKING with him in a caring, concerned way might help him to help you understand where this is coming from. Then talking with the Heart Clinic for a referral to their Psychologist (most clinics will have one) so he can talk through what he is feeling and be made aware he is far from alone in this.