While the form of kyō-machiya as it is today evolved in the 16th century, their origin goes back to Kyōto's founding in 794 as Heian-kyō. Because the city was laid out on a grid, plots were regular in shape and size: A hito henushi was the smallest administrative plot, measuring 15 by 30 metres, which was the 32nd part of an aristocrat's plot. As the city grew larger, so did the number of businesses settling down. The constant demand for scarce building space resulted in the characteristic streetscapes that can still be found today in Gion or Pontochō: many rather narrow houses squeezed together one to another with no or very little space in between. The entrance areas were left earthen, and the dirt floors continued through the length of the house, and it is believed that this is an early form of the tōriniwa and daidokoro of the present machiya. Because tatami mats had not been invented yet, the floors in the house were made of raised wooden boards.
A fundamental addition to the houses was made by adding a first floor towards the 16th century due to a lack of space to build wider houses. Merchants also started to add storehouses so that they could keep personal valuables as well as their merchandise in a safe place. Because those storehouses were made of very thick mud walls, they were quite fire-proof so that anything inside them would normally survive should a fire break out and devastate the surrounding neighbourhood. Around the same time, those merchants became richer and richer, resulting in ever more sophisticated and refined houses. Burnt clay tiles replaced wooden shingles for roofing, to a large part because they improved the safety of the houses in case of fire, and shōji emerged as a lighter variant of the fusuma sliding doors.
Because the aristocracy did not condone the sumptuous decor with which the common merchants adorned their homes, the military government forbade all ornaments such as lacquer on sliding doors or carvings in 1657 after a great fire had consumed most of Edo (the old name of Tōykyō). It is due to this prohibition that the very subtle interior design of traditional machiya evolved, focusing heavily on the flowers and scrolls in the toko no ma and the interior gardens and their change throughout the seasons.
In the following centuries, the houses did not change much. An important turning point came with the capitulation of Japan and the end of World War II. Many Japanese cities had been destroyed and the task at hand was quick urban redevelopment to provide housing for the people and to reestablish a working infrastructure in important areas. As incendiary bombs were used by the allied forces during the last months of fighting, the Japanese cities had burnt down almost in the blink of an eye because most houses were made out of wood. Naturally, their image was not very good, mostly they were seen as an undesirable fire hazard. National legislation was put in place to ensure the swift and thorough reconstruction of urban areas, leaving out of the picture those cities that had not suffered any damage during the war years. Kyōto, together with Nara and Kanazawa, to name the biggest ones, was such a city. The new laws made most of the city's dwellings illegal, so that when they were torn down or had become dilapidated, they could only be substituted with a concrete and steel building. While the situation gradually ameliorated and the legislation agains machiya, or wooden houses in general, became less and less hostile, it contributed a good amount to the destruction of a big part of Kyōto's town houses. The process was only accelerated by the building boom of the 1970s and 1980s and it was only with the burst of the economic bubble in the 1990s that the comparatively few existing machiya became subject to a broader public interest and groups formed to ensure their protection and revitalisation.