In 300 (2006), why does Xerxes consider himself a god? Is there a back story for him somewhere?
Looking at the real Xerxes there doesn't seem to be a background suggesting that he ever claimed himself to be an actual god, apart from the mandatorily high self-esteem every great king and conqueror needs. Rather than that it is probably just that naturally high self-esteem exaggerated in a way congruent with the rest of the movie's plot and style.
As you probably know, the movie is not an entirely accurate rendition of the real historical events, but rather an artistically distorted and exaggerated version (upto the point of including fantasy elements), and told from the viewpoint of the Spartans. And in light of this exaggeration and subjective viewpoint it makes perfect sense to depict Xerxes as a god-like creature or someone who regards himself as a god. This is pretty in line with the whole depiction of the Persians as an invincible and ruthless army of millions (while tens of thousand would have been more accurate) and helps to emphasize both the contrast between them and the mere 300 Spartans with their more down-to-earth king Leonidas and the hopelessness of the Spartans' situation.
(Yet I also have to admit that this is an answer more based on common sense than elaborate research of the real events and the comic's/movie's development process.)
The historical Xerxes probably did not consider himself a god, but he was a legend in his own time.
He removed a golden statue from the temple of Zeus, desecrating the temple, something his father Darius did not dare to do.
From Herodotus, The Histories (Book 1, Chapter 183, Section 3)
When a bridge, built by Xerxes' engineers, was destroyed by a storm on the Hellespont, Xerxes ordered his men to punish the waters.
Again from Herodotus (Book 7, Chapter 35, Section 1)
As a man, he was regarded as exceptionally handsome. As a king, he had gathered an enormous army (Herodotus claims in excess of 1 million, modern scholars estimate 60-150,000) and marched it across western Asia and into Europe. Regardless of the actual number, he was a living legend.
Unfortunately, movies have a tendency to make everyone bigger than life. So when it's time to portray a person that actually was bigger than life, the only choice is hyperbole and exaggeration. Take Xerxes' actual accomplishments and audacity, and combine that with the idea that some ancient rulers tried to cloak themselves in deity, and it isn't too much of a stretch to portray him as was done in 300.