Because languages usually aren't invented as constructs of states. The German language and ethnicity predated both the states of Germany and Austria. The word "Austria" just means "Eastern Realm" in German, as at the time it was one of the more Eastern areas populated by German people.
I don't want to go through in detail the advent of Germanic people in Central Europe, but the short story is: During the later years of the Roman Empire various Germanic tribes found their way into most parts of Europe. The most successful of these was the Franks, the Frankish Kingdom split between West Francia (roughly France) and East Francia (roughly Germany). This period also included the Franks (mostly) forcibly Christianizing their Germanic neighbours, most prominently the Saxons.
East Francia gradually rebranded as the Kingdom of Germany in the 10th century, which overlaps in a complicated way with the Holy Roman Empire. During the Crusades the German Crusaders felt like the Anglo/French leadership de-prioritized their needs, so they formed the Teutonic Order (Duetscher Orden, or German Order) to take care of the German crusaders. People obviously had a German identity by the 11th century (probably among other identities).
People in what is now Germany and Austria, as well as German colonists in places like Transylvania, the Baltics, and Prussia would have spoken German and viewed themselves as German for hundreds of years before the advent of the modern Austrian or German states.
I don't think "Austrian" as distinct from German or anything other than a regional German identity would have existed more than 150 years in the past. This is kinda similar to how 100 years ago most Anglo-Canadians would have considered their Canadian identity a regional subset of their British identity, whereas now relatively few people born in Canada would primarily have a British identity.
The history of both the nations of Austria and Germany are a bit more complicated than that. I’ll get to it in just a moment.
The word German comes from the Latin/Roman and Greek names for the people and region of Germany. The Romans called the Northern European plain Germania. The Greeks called it Γερμανία (Germanía). In English we’ve just held onto the ancient Roman name for the area and its residents. Not all Europeans have done so. The French, Spanish, and Portuguese all refer to it as some form of Alamania; after the Alamanni tribe of Germans. And the Germans call themsleves Deutsche and their language Deutsch.
None the less everyone anciently understood that there was a German people and a region where these German people lived. During the Mediaeval period this area was unified politically into the Holy Roman Empire. The titles changed over time but the royal titles held by the Emperor or at times his heir included Rex Teutonicorum (King of the Germans/Teutons) and Rex Germaniae (King of Germany).
Austria as a political unit came into existence as a subunit of the Kingdom of Germany within the Empire. It survived the eventual fall of the Empire and became a fully independent nation in the modern era, after which the second iteration of the German nation was formed as the Hohenzollern German Empire. But German and Germany as a concept predates not only the German Empire, it easily predates Austria.