In Chinese period media, a very common trope is that of the jiu dian, or restaurant/hotel. This is usually a multi-story building in a city or town, where the first floor acts as a restaurant, and the second floor has rooms to rent. I mostly see this in TV shows or movies set in the Ming Dynasty or later, but that is probably because most shows or movies are set in or after the Ming Dynasty. When did these restaurants/hotels start to exist in China, and how accurate are the media portrayals? I suspect that this is the Chinese equivalent of the "medieval inn" trope.
Edit: To be precise, I am not asking about modern hotels, as I am aware that they can be called jiu dan.
*A quick qualification that my understanding of the inn/lodgings is mainly in the Chinese language so if any portion of my answer seems awkward or a little suspect in English grammar/vocabulary, please do point it out to me.
Jiu dian 酒店 is a term used to describe lodgings provided to travelers so that they may rest and break fast in comfort. However, this term itself was only used from 1970s onward, when the influence of Western culture gave rise to the idea of a 'hotel' - thus the use of '店' (shop) indicating it is a business shop in modern terms.
OP's trope would more appropriately be used to describe the inn 客栈, which as had been described serves the dual purpose of a restaurant and a hotel.
The earliest record of such inns would be during the Shang dynasty, when they were made for the governmental officers on patrol throughout the country. These stopovers 驿 were actually not single structures but a group of buildings that served as satellite outpost of sorts, providing food and lodgings for the officers while the rested their horses and exchanged information and letters. The best preserved would be Yu Cheng Yi 盂城驿 situated in the the Jiangsu region. Although the building itself was built in the Ming dynasty (1375 AD), the place has served as an outpost inn since the Qin dynasty (233 BC).
As opposed to these governmental outposts, public inns 客栈 were rarer in quantity, mainly due to the relative lack of travel by the common people. Only during the Spring Autumn period did the number of inns rise, as people moved in large numbers from state to state in search of peace and stability. The alternate term 馆舍 was also used to describe such inns, encompassing 馆 a place making provision for food and 舍 a place to stay. [source from Zhou Rites 周礼, a classic on governance written during the Warring States period]
Due to the extended period of unrest (Spring Autumn followed by Warring States), the number of inns rose meteorically. This led to lesser people willing to stay in the traditional agricultural occupations, most preferring to go into trade or other merchant businesses (since travel is easier with inns to rest at along the way). At this time Shang Yang 商鞅 an official from the state Qin noticed this trend and tried to stop the influx of traders with a new legislation stopping the proliferation of inns 废逆旅令, with hopes that it will return people back to their agricultural roots. However, that only made people more enthusiastic about travel, and the legislation did not achieve much success. [source from the Book of Lord Shang 商君书 written during the late Warring States period, purportedly authored by Shang Yang although historians still disagree on the matter]
By the Han dynasty, inns were commonplace, with some choosing to serve specific sectors of the population. These were especially popular along the northern and western borders where foreigners often came into China for trade.
The outposts built for government services soon lost favor as public inns became the norm, but come the Tang dynasty Li Shimin changed that by instructing that proper governmental inns 旅馆 were to be constructed at intervals such that one would come across an inn every 15km. This resulted in over 1600 governmental inns, ensuring that officials were well housed and provided for when travelling. [source Old Book of Tang written by Liu Xu 刘昫, and edited by Zhao Ying 赵莹 both from the late Jin dynasty 945 AD] These governmental inns did not exclude the general public from use, but usually cost far more than private inns 旅店, and as such only officials or rich merchants could afford to stay there.
The media portrayal of the inn (most famously Dragon Gate Inn 龙门客栈) comes mainly from the Wuxia genre, wherein the pugilists often rest at such inns to recuperate and exchange information. In these stories, the innkeeper as well as the waiting boy 店小二 often help to relay important plot points through word of mouth, aiding the heroes in unexpected ways.
The actual look of the inns are probably fairly accurate, with the two floor design becoming more prevalent as the cities get more crowded. Otherwise older designs tend to have a larger compound made up of different buildings for food and lodgings.
All inns require some form of identification before they will be willing to put you up for the night. This comes from the fact that inns were originally made to put up government officials as they traveled on patrol. Even after private inns sprung up, the practice of checking travel documents remained. Since the common people tended to stay at home, only merchants or other frequent travelers would request for identification to travel.
The guests were also required to put down their information on a book 店薄 so as to ensure that a clear record of patrons was kept for sporadic checks by the officials. Naturally people on the run from the law would not be able to put up as such establishments. As such, certain anti-government pugilists would have no luck checking in.
As for the passing of information, inns were often collection and distribution centers for letters and other documents that needed to be passed along from city to city, therefore it is not far fetched for the innkeeper to pick up some information along the way.
A related question how exactly did the name (Jiu Dian) develop in the first place?