Hello! I would like to know how this subject was seen in Achaemenid Persia, specifically during the time of the war against the Greeks, as I am writing a story in which a character with these characteristics appears in this period. Any help would be appreciated ^^
This is an interesting question, and fairly complicated to answer for all of the same reasons that discussing homosexuality in other ancient cultures is difficult. The modern conception of labeled sexualities did not exist at the time. Famously, Roman male same sex relationships have been oversimplified as a question of power dynamics rather than a question of gender. If two men had sex, the one being penetrated was seen as taking the feminine role, which was socially degrading, whereas the man doing the penetration was in the masculine role, and there was little controversy aside from occasional snide remarks.
We don't have many sources from Achaemenid Persia in the first place, and basically none of what we do have sheds much light on the private lives of the Persians themselves. Herodotus asserts that the Persians learned pederasty from the Greeks, though other ancient sources and modern scholarship alike agree that the Persians probably had similar practices long before meeting any Greeks. Pederasty is another weird dimension to any conversation about ancient history. Most famously a part of Greek and Roman culture, it appears across the ancient Near East as well. It was the practice of an adult man having a sexual relationship with a teenage boy. In the understanding of the time, it was generally seen as consensual but often had a dimension of an authority figure or mentor having sex with a much younger boy, which we would generally recognize as sexual abuse today.
In The Symposium, Plato asserts that the Persians outlawed pederasty for their subjects on the basis that it was considered a noble privilege. That at least suggests that it was a practice of the Persian nobility. Despite this, very few examples of such relationships actually appear in our sources. The only one that might be interpreted that way is the relationship between Bagoas and Darius III. Bagoas was a young eunuch courtier in the last Achaemenid court, who is better known for the well documented relationship he had with Alexander the Great, but Quintus Curtius Rufus says that Bagoas was one of Darius' lovers as well. He is always described as young or youthful, but none of the Alexandrian sources really hints at how young we are supposed to interpret that. He could have been in his early teens while Darius III was still in power, or he could have been a young man.
In the Persian context specifically, it's also hard to identify what would have constituted a "youth" compared to an adult. Several sources lay out the Persian educational system, but Xenophon's description in Cyropaedia is the most detailed. The basic format described has a class of boys under the age of 16, and a class of young men between 16 and 25. If that is consistent with the Persian understanding of youth, then the practices interpreted as pederasty by the Greco-Roman authors may have at least been with older "youths" than the Greeks expected.
Within all of this, there is also an added dimension of eunuchs - castrated men. Though ancient sources always describe them as men, and there's very little evidence to suggest that the eunuchs self-identified any other way, modern scholarship occasionally discusses eunuchs as a sort of third gender category. Eunuchs were often the preferred male servants in exclusive women's spaces in Near Eastern cultures both before and after the Achaemenids. They were also regularly selected for high level administrative duties on the basis that, since they could not form dynasties of their own, they would have less desire for personal power. In the context of sexual relationships, many Greco-Roman sources suggest that eunuchs, rather than fully developed young men, were the recipients of Persian men's "male-male" affection.
But there is a contrasting point to this. The Vendidad is a Zoroastrian law code that reached its current form sometime after the 4th Century BCE. It is written in the Younger Avestan language, but with bizarre gramatical errors and inconsistencies that lead scholars to believe that individual fragments of laws were memorized by rote according to Iranian oral tradition long after Younger Avestan had died out as an actual spoken language. Eventually these laws were compiled together in a single text, stringing together semi-coherent passages from memory, but the individual rules must have developed in a time when Younger Avestan was still in use. That means they must have developed during or before the Achaemenid period, since Younger Avestan is thought to have been spoken in eastern Iran until about 400 BCE.
One section of the Vendidad is a prohibition again non-reproductive ejaculation, either intentional or unintentional, where the punishment is a series of ritual beatings with different types of whip. That section is followed immediately by a prohibition against male-male sex of any sort, regardless of who is doing the penetration. Uniquely among all of the laws and religious crimes in the Vendidad, male homosexuality alone is seen as completely unforgiveable. The actual description explains that both partners become daiva (corrupted spirits/gods) in their souls as a result of the act. Later Zoroastrian commentaries even take the prohibition against unintentional ejaculation and apply it to victims of male-male sexual assault, meaning the punishment for being a male rape victim was also a series of ritual beatings.
The opening chapter of the Vendidad associates different severe sins with different regions of the early Zoroastrian world, and specifies that male-male homosexuality was a sin particularly associated with Hyrkania, the region around the modern Iran-Tajikistan border. Possibly of interest to your project, this also seems to be the area where Xerxes was Satrap, or had some other government position during his father's reign according to one of the Persepolis Fortification Archive tablets.
So while the Greek and Roman sources make it clear that the Achaemenid nobility engaged in some level of homosexual pederasty, the priests on the eastern side of the empire were formulating religious law codes that condemned male homosexual sex acts above all else.