Respiratory tract infections are often associated with chest pain (which is not necessarily due to heart cause). The lungs have an outer covering called pleura that separates it from the chest wall. As the lung expands and contracts during respiration, the layer of pleura that covers the lung (mobile) rubs against the outer layer of pleura adherent to the chest wall (fixed). In case of a respiratory tract infection, the pleura may get inflamed (a condition called pleurisy) and the friction between the two layers of pleura may give rise to the chest pain that the child mentions. I do not think that it is the heart hurting.