It goes back way further than the fantasy genre or even written literature.
I've listed a few of the best-known examples of this trope dating back to centuries before the idea of a "trope" was even in circulation. This is by no means an exhaustive list.
Judaism. For thousands of years, religious Jews have avoided speaking the name of God. In the 1906 Jewish Encyclopedia, it is suggested that all Hebrew proper names are 'true' names, more than simply labels, but saying something about the essential nature of the named person:
Like other Hebrew proper names, the name of God is more than a mere distinguishing title. It represents the Hebrew conception of the divine nature or character and of the relation of God to His people. It represents the Deity as He is known to His worshipers, and stands for all those attributes which He bears in relation to them and which are revealed to them through His activity on their behalf. A new manifestation of His interest or care may give rise to a new name. So, also, an old name may acquire new content and significance through new and varied experience of these sacred relations.
And Wikipedia tells us a little more about the practice of not speaking the name of God:
although there is nothing in the Torah to prohibit the saying of the name and Ruth shows it was being pronounced as late as the 5th century BCE—it had ceased to be spoken aloud by at least the 3rd century BCE during Second Temple Judaism
Egyptian mythology. As mentioned by Mithrandir, the concept of a person's true name granting power over them appears in tales of Egyptian mythology from thousands of years ago. From Wikipedia, cited to Geraldine Harris, Gods & Pharaohs from Egyptian Mythology:
Isis frequently schemed against Ra, as she wanted her son Horus to have the power. In one myth, Isis created a serpent to poison Ra and only gave him the antidote when he revealed his true name to her. Ra now feared Isis, as with his secret name revealed she could use all her power against him and have Horus take over the throne.
Traditional folk tales. The well-known folk story of Rumpelstiltskin revolves around this idea: the miller's daughter rashly promises her first-born child to the strange little man, and he will only allow her to keep the child if she can tell him his name. From this translation:
“I will give you three days,” said he, “and if at the end of that time you cannot tell my name, you must give up the child to me.” Then the Queen spent the whole night in thinking over all the names that she had ever heard, and sent a messenger through the land to ask far and wide for all the names that could be found. [...]
The third day the messenger came back again, and said, “I have not been able to find one single new name; but as I passed through the woods I came to a high hill, and near it was a little house, and before the house burned a fire, and round the fire danced a comical little man, and he hopped on one leg and cried, ‘Today do I bake, tomorrow I brew, The day after that the Queen’s child comes in; And oh! I am glad that nobody knew That the name I am called is Rumpelstiltskin!’" [...]
And then she said, “Then perhaps your name is Rumpelstiltskin!” “The devil told you that! the devil told you that!” cried the little man, and in his anger he stamped with his right foot so hard that it went into the ground above his knee; then he seized his left foot with both his hands in such a fury that he split in two, and there was an end of him.
More recently, it was likely popularised by le Guin and maybe Clarke.
The TV Tropes page entitled "I Know Your True Name" lists Ursula le Guin's Earthsea series as the Trope Codifier - the work which, while it wasn't the first to use the idea, was more popular than preceding works and provided the template for most or all later uses of the trope.
He saw that in this dusty and fathomless matter of learning the true name of each place, thing, and being, the power he wanted lay like a jewel at the bottom of a dry well. For magic consists in this, the true naming of a thing. So Kurremkarmerruk had said to them, once, their first night in the Tower; he never repeated it, but Ged did not forget his words. "Many a mage of great power," he had said, "has spent his whole life to find out the name of one single thing - one single lost or hidden name. And still the lists are not finished. Nor will they be, till world's end. [...] That is the language dragons speak, and the language Segoy spoke who made the islands of the world, and the language of our lays and songs, spells, enchantments, and invocations. Its words lie hidden and changed among our Hardic words. We call the foam on waves sukien: that word is made from two words of the Old Speech, suk, feather, and inien, the sea. Feather of the sea, is foam. But you cannot charm the foam calling it sukien; you must use its own true name in the Old Speech, which is essa.
No one knows a man's true name but himself and his namer. He may choose at length to tell it to his brother, or his wife, or his friend, yet even those few will never use it where any third person may hear it. In front of other people they will, like other people, call him by his use-name, his nickname - such a name as Sparrowhawk, and Vetch, and Ogion which means 'fir-cone'. If plain men hide their true name from all but a few they love and trust utterly, so much more must wizardly men, being more dangerous, and more endangered. Who knows a man's name, holds that man's life in his keeping.
-- A Wizard of Earthsea: The First Book of Earthsea (emphasis mine)
In fact, although it's best known from her Earthsea quartet, le Guin had used the same idea in some of her earlier stories, lesser-known precursors set in the world of Earthsea. The Rule of Names, a short story published four years before A Wizard of Earthsea and available in full as a PDF here, seems to be the first le Guin work to introduce her idea of true names:
"Now you know the Rules of Names already, children. There are two, and they're the same on every island in the world. What's one of them?"
"It ain't polite to ask anybody what his name is," shouted a fat, quick boy, interrupted by a little girl shrieking, "You can't never tell your own name to nobody my ma says!"
"[...] When you children are through school and go through the Passage, you'll leave your childnames behind and keep only your truenames, which you must never ask for and never give away. Why is that the rule?"
The children were silent. The sheep bleated gently. Mr. Underhill answered the question: "Because the name is the thing," he said in his shy, soft, husky voice, "and the truename is the true thing. To speak the name is to control the thing. Am I right, Schoolmistress?"
-- The Rule of Names (emphasis mine)
So much for fantasy, but the same idea also crops up in science fiction. In the short story "The Nine Billion Names of God" by Arthur C. Clarke, we can see an intermediate step - a literary Archaeopteryx, if you will - between the ancient religious idea of the holy and powerful "true name of God" and the idea of true names as they appear in modern speculative fiction:
‘Well, they believe that when they have listed all His names – and they reckon that there are about nine billion of them – God’s purpose will be achieved. The human race will have finished what it was created to do, and there won’t be any point in carrying on. Indeed, the very idea is something like blasphemy.’
‘Then what do they expect us to do? Commit suicide?’
‘There’s no need for that. When the list’s completed, God steps in and simply winds things up … bingo!’
‘Oh, I get it. When we finish our job, it will be the end of the world.’
“Wonder if the computer’s finished its run? It was due about now.”
Chuck didn’t reply, so George swung round in his saddle. He could just see
Chuck’s face, a white oval turned toward the sky.
“Look,” whispered Chuck, and George lifted his eyes to heaven. (There is always a last time for everything.)
Overhead, without any fuss, the stars were going out.
-- "The Nine Billion Names of God"
Of course, we've already seen that neither le Guin nor Clarke were anywhere near the first to use these ideas, and perhaps not even the first in popular speculative fiction. But as the most popular/famous authors to do so, they likely had the largest effect on the subsequent development of the trope. Certainly the effect of le Guin's particular interpretation of it can often still be seen in modern fantasy novels to this day. I'm unsure how influential Clarke's sci-fi interpretation has been (indeed, it might be hard to distinguish between influence from his story and influence directly from Jewish religious beliefs), but in any case "The Nine Billion Names of God" is probably the most famous sci-fi appearance of the "true names" trope, so I thought it was worth a mention.