My understanding is that The terminology of 'substance' and 'accident' are terms developed by Aristotle. No doubt translated into a Latin 'substantia' and 'accidentia' -- but still Aristotle's concepts of what makes up  'reality'.

During the Crusades the West re-discovered Aristotle, whose writings had been preserved by the Muslim scholars. No doubt some of the other theologians of the time were fascinated with this 'new' philosophy.  St. Bonaventure and others still preferred their traditional Plato.

'Substantia' or 'substance', though –as far as I can figure out  is still just a mental 'category' for things. When do we call something a 'chair'. rather than a 'stool' or a 'couch'. It's 'what a thing is' in our mental classification.

Thomas applied it to Eucharist - what we called 'bread' is 'trans'-formed so that by faith we now call  it "'Presence of the Risen Glorified Jesus, whole and entire, body and blood, soul and divinity" as the Official Church Doctrine puts it.