The karahafu (唐破風) is perhaps the most instantly recognisable Japanese architectural feature, yet it's origins are not well established in Western literature. Folk etymology suggests that the style was imported from China some time during the Nara or Heian period, following the usage of "唐" as in "唐様" (karayou, "Tang [Chinese] style"), another name for 禅宗様 (zenshuuyou, "zen style"). However, according to the few English language sources I've been able to find online, the karahafu is a Japanese invention of the Heian period.
(Diagram of two styles of karahafu seen in Japanese castles)
This does little to clarify the origins and significance of the karahafu, however, and many questions remain unanswered.
Although the design of the karahafu is quite different from anything that can be found on the continent, it is also atypical pre-Buddhist architecture, suggesting that it doesn't derive from vernacular or "purely indigenous" Japanese styles (e.g. taisha-zukuri (大社造)). The usage in palatial and religious architecture, particularly prior to the Edo period, places the karahafu closer to the Sinicised (or, perhaps, Koreanised) traditions of Japanese architecture.
There are also peculiar features of the karahafu indicative of conscious design choices. The ibara-hire (茨鰭) on the barge board and rafters, for example, can be seen in even the earliest depictions of Karahafu despite being relatively difficult to create (compared to a simple, arched gable) and serving no apparent function.
What purpose (structural or symbolic) was the karahafu originally intended to serve? Did the style evolve naturally over time or was it introduced by a person or group of people (possibly in connection with Buddhism)? In the case of the former are their transitional examples between earlier predecessors and the modern design (as with other architectural elements like the noyane (野屋根))? In the case of the latter is there any record of the progenitor?
A note on dates:
The date given in history texts for the construction of buildings is, ordinarily, the date that the building was first constructed, rather than the date when the present structure was built. In many cases, a building will be destroyed and later reconstructed - so that the present building is not the one first mentioned in primary sources.In most cases, the reconstructed building is built in the contemporary style, and does not accurately reflect the time period of the previous structure. This is a hurtle that I have encountered when discussing architecture history in general, not just Japanese architecture history. The same problem occurs, for example, when discussing the architecture of older churches.
A note on early examples:
According to the English wikipedia article, the earliest example of karahafu can be found on a miniature shrine held in the shouryo-in (聖霊院) at Houryuuji (法隆寺) in Nara, and dates to ~1278. However, according to this blog post, no photography is allowed in the shrine (the author does provide a sketch, however). I have not been able to find any studies relating to this particular shrine, and I cannot verify its age.
The earliest [standing] example with a definite date belongs to the Izumo Takeo Jinja Haiden of Tenri Isonokami Shrine (石上神宮摂社出雲建雄神社拝殿), dated to ~1300. Although the building was dismantled and moved to its present location in 1914, depictions of the shrine on 18th century maps indicate that it has maintained its original design since its construction.
The earliest depictions which I have been able to find are in paintings - specifically, the Tokyo museum's copy of the Story of Obusuma Sakuro handscroll (男衾三郎絵巻), dated 1295, shows a corridor (called kairou in Japanese, I think?) and a boat with karahafu. The detail can be seen here:
Another early depiction, dating to the 14th century can be found in the Illustrated Biography of Priest Hounen (紙本著色法然上人絵伝1巻).
In addition to these, there seems to be a now-extinct roof style which vaguely resembles karahafu that can be found in the Moukou Shuurai Ekotoba (蒙古襲来絵詞), dated 1293, and the Raigo of Amida and Twenty-five Attendants (阿弥陀二十五菩薩来迎図), dated to the 13th-14th century. I cannot say for certain whether or not this type of arched gable has any connection to the karahafu.