From a Harvard Medical School article:
Costochondritis is caused by inflammation of the cartilage between the ribs and the breastbone, called the costosternal joints (see illustration). This uncommon condition can trigger a stabbing, aching pain that’s often mistaken for a heart attack.
The main symptom of costochondritis is chest pain, which may be sharp or dull and gnawing. It tends to get worse when a person takes a deep breath or coughs, and the chest may feel tender and possibly swollen when pressed. In contrast, people in the throes of a heart attack often say they feel chest discomfort rather than chest tenderness, and they describe sensations such as squeezing, tightness, pressure, or feeling like an elephant is sitting on my chest.