Why is the human body able to repair a broken bone and not a heart muscle?
Part of the answer may be(*) that in bone, you have still stem cells everywhere (blood capillaries that grow until checked and osteoblasts), i.e., also in the vicinity of the wound. The same applies to skin, by the way, where the epidermis continues to produce skin layers until eternity. This facilitates repair enormously, as new cells won't have to move far to take their place.

Contrast this with heart or spinal cord, where the placement of the cells took place in early development when distances were small and most cells were undifferentiated. Also, no tissue like epidermis was left in the vicinity that could act as a near source of new cells.

(*) I said "may be" because 1. I have no ref for this, and 2. I have no idea to what extent other factors are involved. I would be thankful for counterexamples.