Hi Shiroi. There are a few stories about the origin of the festival. Some one says it's due to the story that , in the Nambokucho peroid (period of the Northern and Southern dynasties), Tsushima worriors invited worriers of Northern side go boating on the Tennoh River and subdued them in order to save Prince Ryoou (grand son of Emperor Godaigo/ Southern side) who escaped to Tsushima.
Other texts say that this festival was based on the shinto ritual of Tsushima Shrine, "Miyoshi-nagashi". But no one really knows the real story about its origin. However, it can be said that it's started approximately 500 years ago, based on "Kami-mukae (welcome gods"ritual in old religion among the people who wanted to avoid disease successfully in the equatorial summer, and has been grown as a popular festival.