Short answer is no, it's not a modern concept. I used to think it was but I've come across a lot in my reading that has forced me to second guess that assumption.
The most successful "non-fiction" book of the 1990s was "Men Are from Mars, Women Are from Venus". Contrary to this books clearly delineated and perhaps exaggerated notions of gender where there exists only two; there has existed, for some time now a concept of a third gender, Uranians (from Uranus, coincidentally enough).
The term came to prominence in the Victorian era, I first came across it when reading Douglas Murray's biography of Lord Alfred Douglas, Oscar Wilde's lover (who identified as Uranian). While it is a largely Victorian concept, the classicists who identified as such seemed to think it was a concept discussed in Plato's Symposium (which explores ancient views on human sexuality if you're interested). It's pretty clear, that even among the Greeks, who are often regarded as being responsible for our paradigms of Masculinity and Femininity, some lent credence to the notion of androgyny and other nuances in gender. I'll stop with the Greeks there, as I just committed the carnal sin of generalizing them.
Eunuchs are fairly ubiquitous in ancient societies and seem to occupy a myriad of roles. If one defines Transgender as Google does (denoting or relating to a person whose self-identity does not conform unambiguously to conventional notions of male or female gender.) Would it not be necessary to at-least consider considering those who deliberately discarded their male genitalia as Transgender? While a good many Eunuchs had no choice in their mutilation, a fair few did - and motivations for becoming a Eunuch are numerous. Many did so to commit themselves to religious or civil service. Not Ancient, but the man who killed the man who killed Abraham Lincoln - Boston Corbett castrated himself because of his reading of the Gospel of Matthew.
These associations are controversial because it's difficult to ascertain motivations and even more difficult to compare say the identities of a Eunuch devoted to a religious order living in 300BCE to a trans-gendered person today. One thing I will say, is the ancient subcontinental concept of the ["Hijra"](https://en.wikipedia.org/wiki/Hijra_(South_Asia) seems to have blended quite seamlessly into modern Transgender movements implying some continuity. There are references to the Hijra in the Kama Sutra as well as the Mahabharata so they pre-date most world religions, it seems.
Off the top of my head there's also:
-Marcus Justinus, a 2nd century Historian described the legendary Assyrian King Ashurbanipal as "a man more effeminate than a woman"
-The "Effeminate ones" of classical Arabia known as Mukhannathun.
-Modern, but fascinating, the case of Chevalier d'Eon, the 18th century French spy who began dressing as woman for the purposes of espionage, and who eventually began to identify as such, in earnest. There are a fair few anecdotal examples of this which are retrospectively cited as proof that the Trans identity is nothing new.
-And this superb (pre modern, though not ancient) legal case concerning a [14th century Cross-Dressing English prostitute.] (http://legacy.fordham.edu/halsall/source/1395rykener.asp)