A long time ago, the Chinese began collecting wild carps to keep them as decorative elements in outdoor ponds. Rare color mutations and strange shapes were especially popular and such fishes were used for selective breeding. These fishes would not have survived long in the wild since their striking coloration and unsuitable fins made them an easy target for prey, but they thrived in the protected ponds of China and were well cared for by the Chinese pond keepers. One of the first mentionings of exceedingly colorful carps kept in outdoor ponds dates back to the 4th century AD and the Western Jin Dynasty. Nobody knows for sure exactly wish carp species that gave rise to the goldfish, but Carassius carassius is a feasible guess.
While the goldfish has a really long history in China, it wasn’t introduced to Japan until the early 16th century. The goldfish grew immensely popular and soon Japanese breeders tried to replicate it by selecting Japanese carps and use for selective breeding. The result was the Koi fish. Koi is often referred to as goldfish, but it is not a true goldfish. There are however true golfish variants hailing from Japan; the Ryukin and the Tosakin. The word Koi simply means carp in Japan and is only used for wild carps. If you want to buy Koi while in Japan, you should instead ask for Nishikigoi.
The first goldfish to make the journey to Europe was imported to Portugal in 1611, when Portugal was an important seafaring nation. Keeping goldfish soon grew popular throughout Europe. This was long before they electrically heated aquariums of today, but since goldfish hail from wild carps living in chilly Asian waters, keeping goldfish in an unheated room was not a problem, not even in drafty old European castles and mansions. Goldfish was not introduced to the North American continent until 1874.