The ancients had different metaphors to describe the location of feelings, emotions and intentions than we do. The fascination with the heart and the assocation of love with the heart began in the late middle ages.
There are some references to the “heart” in a metaphoric sense in Scripture - Ezekiel talks about God giving men “an undivided heart” and in Luke 6 Jesus says the good man brings forth good from the good that is stored in his heart. Ecclesiastes talks about a joyful heart and Obadiah warns against a prideful one. And of course, Simeon tells Mary that her heart will be pierced. So it’s not unknown. But the emphasis on the Sacred Heart is a fairly recent devotion, if that’s what you are thinking about.
Anatomically, the lance with which the soldier pierced the side of Jesus to ensure that He was dead when they took His Body from the Cross must have pierced the pericardium - that would explain the flow of blood AND water from His side, which of course we understand as being symbolic of the life-giving sacraments of Baptism and Eucharist.