Were there circumstances that made it necessary to do one rather than the other? Or is it just random?
In case this doesn't get answered here, you might want to try /r/askanthropology.
Chinese translator here with a background in Chinese linguistics as well as Classical and Literary Chinese. I can only speak for Chinese in this instance.
Some of the earliest forms of Chinese writing appear in a divination ritual known as pyro-scapulimancy, wherein questions were carved into the prepared shoulder bone of an ox, a turtle shell, or sometimes shells. These are known as "oracle bones" (甲骨). A very hot piece of metal was then inserted into crevices or pits of the bone, which would crack from the heat. The cracks, which might point towards or away from text on the bone, would be interpreted as a form of fortune telling. This was an important cultural phenomenon in China's Shang Dynasty (Approx. 1600 BCE to 1046 BCE). Endymion Wilkinson in Chinese History: a Manual, points out that "Late-period oracle bones are usually incised in columns from top to bottom and from left to right, although sometimes in rows from right to left to right depending on the contour of the bone or shell."
Later on, brush and ink became the primary method of transcribing Chinese, particularly for official record keeping and daily use. Before paper was developed, long strips of bamboo, known as slip fascicles, were tied together and used as a writing surface for brush and ink. These looked somewhat like a modern day Venetian blind, and on these surfaces Chinese characters were written vertically in columns and continued from right to left. For storage and transport, these fascicles were rolled up from left to right such that when they were opened, you would be reading from the beginning of the text.
Chinese, as a logographic language, can easily be written in any direction. It is likely that the natural shape of oracle bones and later, bamboo fascicles, contributed to vertical writing becoming the predominant practice for writing Chinese throughout China's history. Currently, most modern texts from Mainland China are published horizontally from left to right, just like English. However, official Taiwanese documents such as legal texts and formal written correspondence tend to be written vertically from right to left. Many novels published in Taiwan and Hongkong are also written this way.