Here is an interesting essay by Victor Davis Hanson on the extent to which "300" is (and is not) true to historical accounts of the battle of Thermopylae. Although adapted from a Frank Miller graphic novel, the answer is, more than you might have thought.
300 preserves the spirit of the Thermopylae story. The Spartans, quoting lines known from Herodotus and themes from the lyric poets, profess unswerving loyalty to a free Greece. They will never kow-tow to the Persians, preferring to die on their feet than live on their knees.
If critics think that 300 reduces and simplifies the meaning of Thermopylae into freedom versus tyranny, they should reread carefully ancient accounts and then blame Herodotus, Plutarch, and Diodorus — who long ago boasted that Greek freedom was on trial against Persian autocracy, free men in superior fashion dying for their liberty, their enslaved enemies being whipped to enslave others.