There is a text written by Luther called "an den christlichen Adel deutscher Nation" (exact spelling!).
So the word "deutsch" is very old.
However, even from the 1848 revolution on (short-living foundation of a German Democracy that was supposed to overcome the small monarchies ("Kleinstaaten")) or from 1871 on (Foundation of the 2nd Reich), Germans didn't consider themselves as Germans at once.
Yes, it was the same German Empire, with the "Kaiser der Deutschen" from 1871 on, but people still identified themselves strongly with their Land and their respective King (Württemberg, Sachsen, Bayern, Hessen ...) or City (Hamburg, Bremen, Lübeck) that constituted the federally organized Reich.
One interesting source is the author Karl May: In his adventure stories, he gave Germans mostly positive roles, but among them, all German heros were Saxonian (as the author himself).
Maybe it is similar for Americans form the US:
Being American but being Texan (etc.)
as well.
So there was a slow transition that was not equally fast.
This transition came to an end in the years around 1933.
I once read that from that time on German mountaineers wrote "deutsch" as their nationality in the summit logs much more often.
Previously, they preferred "bayrisch" or "sächsisch" etc.
This is an interesting source because summit logs are for the voluntary mountaineering community only, so it is not influenced by the authorities claiming their citizens.
history.stackexchange.com/users/26021/Horst Grünbusch
The word Deutsch itself has deep roots.
The name Dutch is a cognate.
If you're willing to reach way back, the word's ancestry can be traces to the proto-Indo-European word tewtéh [1] meaning people, tribe or the ruler of a tribe.
Its English cousin would be the word thede, also meaning people or kinfolk.
In Irish Gaelic you can find 'tuath,' with the same meaning.
The word Teuton arose from this root as well.
The question, in my view, isn't when the word Deutsch started to be used as much as when did it take on this particular spelling and become imbued with a modern understanding in the sense of nation states.
The other answers here seem to clarify that question.
[1] https://en.wiktionary.org/wiki/Reconstruction:Proto-Indo-European/tewt%C3%A9h%E2%82%82
history.stackexchange.com/users/26034/josh
The term has evolved gradually, with the root phrase being listed in Wikipedia :
Theodiscus is a Medieval Latin term literally meaning "popular" or "of the people".
Later in the same entry it states: However, in German, the use of the term referring to Germans specifically as opposed to people speaking Germanic languages in general evolves during the Early Modern Period and it is in the late 17th and 18th century that the modern meaning of Deutsch is established.
L. Weisgerber, Deutsch als Volksname 1953
history.stackexchange.com/users/16951/justCal
The term must definitely have been in common use by 1863, at the very latest, as it is used in the inscription on the floor of the Hall of Liberation .There, it was still spelled Teutsche , however.
history.stackexchange.com/users/26014/der_gabe
I am a german student and the theme in history last semester was the founding of Germany.
In the war against France, before 1871 students and poets started saying that we the Germans have to fight together against France (they wore black, red and gold which became the colors of the flag).
This was the time when most people called themselves German. Before they used the state name and being German was more defined about the language (Luther translated the Bible to german therefore the german language got more equality in this time) than the border.
history.stackexchange.com/users/26029/Niklas
King Ludwig (806-976), now called "der Deutsche" in modern german history-books, was labeled as ruling "Teutschlandt" in the year 1500.
So, the word was in use as early as this.
But at this time it probably meant the land of the people who spoke "teutsch".
history.stackexchange.com/users/24524/user1021794
When Otto the great became holy emperor of Rome
the Italians began calling the ethnic group comprised of German people "teutsche" jokingly
and they adopted the name.
history.stackexchange.com/users/37371/Leah Russell
Up to 1871, ancestors of today's Germans lived in different states.   What did they call themselves in those times? What did Germans call themselves in the 18 th  century?  Did they call themselves "Deutsche" or did they use names derived from names of states like Prussians, Bavarians, Saxons, et cetera?  When did Germans start to call themselves "Deutsche" en masse?
When did Germans begin to call themselves "Deutsche"?
history.stackexchange.com
<germany><ethnicity><demonym>
history.stackexchange.com/questions/39131
history.stackexchange.com/users/26012/AndrewV
The word "Deutsch" is very old. It was in common use at least as early as 1863. The term "Deutsch" is very old and, at the latest, was in use by 1863 because it is inscribed on the floor of the Hall of Liberation.
The term "Deutsch" is very old and, at the latest, was in use by 1863 because it is inscribed on the floor of the Hall of Liberation.