The (modern) problem with history painting is, that most European languages doesn’t make any difference between "story" and "history". In French its only "histoire", in Italian "storia" and in German "Geschichte". The meaning is that likewise there wasn’t any difference telling or in our case painting a story if this was about things what had really happened or about religious or mythological subjects.
Important is that history paintings are "narrative", that means they want to tell something. Therefore it is crucial that the contemplator of a painting already knows the story so that he can understand the signs and symbols. The artist gives only a new interpretation of a well known story.
Because the artist and his audience are dependant of that common knowledge history painting was long dominated by religious subjects. Later when with the Renaissance Greek and Roman mythology became better known, paintings with these topics became popular. But still nearly nobody painted medieval heroes or battles, just for the simple reason that theses were not known at all.
But even when historical subjects (in a modern understanding) were painted they were normally taken from literature. Cäsar, Richard III were known because of Shakespeare and not from history books. Medieval Italy was known because of Dante. Later national heroes like Joan of Arc or William Tell could only become subjects of art because they were already known by literature.
It was then in the 19th century when history became a science with the pretension of objectivity, that some started to make a difference between history, religious and mythological paintings. But despite that history painting improved in many historical details like costumes and weapons it continued idealizing and romanticizing, in short it continued telling stories.
A typical Renaissance history painting.
Salome with the head of John The Baptist. It was a well known story then. That the costume wasn't "historical" at all was of no importance.
A romantic 19th century painting. The princes in the tower. The painter made a good work in the historical details, but nevertheless the story is pure Shakespeare fiction.
Its still a story only in better costumes!