We all know the generic music they play in the media for ancient Egypt, Persia, China etc... Is all of that just Hollywood invention or is there any historical accuracy to the music?
Pretty much all of it is educated guesswork. We have music notationfrom many ancient civilizations, but we don't have a "Rosetta Stone" document for how to interpret it.
Likewise we have many surviving musical instruments from all over the world, but we don't know how they would have sounded, or been tuned or played.
That being said, there is a lot of very educated guesswork that can happen from here. Take, for example, Ancient Greece. Say someone found a stringed instrument from the period, but in pieces, and missing its strings. Thankfully, there's also a ton of Greek pottery that depicts people playing that instrument, so there would be an idea of how many strings, how it would be held, and generally how it would be played. So you can make a reconstruction with authentic materials, string it, and have a very close replica.
As far as music, there are a lot of commonalities amongst music all around the world, notably the pentatonic scale, and a folk music tradition that is typically passed on by rote through the generations without much change. Often that can be used to get an idea of what music would have sounded like.
Then, there have been historians who have looked at the ancient Greek music notation, and, working with music historians have been able to interpret the musical notation and create what they believe to be the correct modern equivalent for the notation. I hate to link to a wikipedia article, but they have a few good charts that demonstrate the modes well (you'll definitely need a music theory background for a lot of this to be of use to you) and their modern equivalents, typically Middle Ages modal music: https://en.wikipedia.org/wiki/Musical_system_of_ancient_Greece
So, we put all this together, and you get this: https://www.youtube.com/watch?v=9RjBePQV4xE
A musical composition that is as close as we can currently get to what it would have sounded like. It's definitely all guesswork, but the most educated guesswork we have. So, it's probably pretty close, but we have no way of knowing for sure unless someone unearths a manuscript of how to interpret the musical notation we have found.