Was there any explanation of the origin of the Borg from Star Trek?
I've seen most of the TV shows but not read any books - is it explained there?
I understand that there's no definite answer but on Memory-Alpha it says that Borg was the product of cybernetic augmentation of living organisms that was advanced to the point where they ceased to be the species they were before that and became Borg. The hive mind probably started as the means of communication and sharing the information (just like the internet) and as species relied on it more and more (just like we are on the internet) they gradually lost the capability of functioning without it (just like we... well, maybe not yet :) and became the hive mind.
This was covered in David Mack's Star Trek: Destiny series of books. Whether this is considered canon or not is up for debate, but it's certainly a good story. To summarize very briefly, there exist a very advanced and xenophobic race known as the Caeliar, and their technology is such that they've replaced their bodies (which presumably were biological in nature as our own are) with particles called catoms. These catoms allow them all sorts of abilities. However, they require an energy source, one of which is located in the centre of each Caeliar city (/spaceship).
An event occured whereby one of these cities was destroyed and sucked into the distant past. The demise of this city's power source meant that the survivors required an energy source. Over time, they became more and more desperate until essentially their concious mind (and morals, etc) was lost and their catoms' "instinct" (for want of a better word) took over in order to secure their survival. Over time, the Borg were born: the Borg nanoprobes are a severely warped and damaged (and less capable) version of the Caeliar catoms.
I won't spoil the books by explaining what beccomes of the Borg... and I have rather butchered the story there. Well worth a read of them to make proper sense of this.
There's an interesting theory involving the Voyager 6 probe (V'Ger) mentioned on Memory Alpha: http://memory-alpha.org/wiki/Voyager_6#Apocrypha
"Star Trek: Legacy" presented the theory that the 20th century Borg civilization was a peaceful race. When V'Ger encountered them, they studied its programming, repaired the probe, and sent it on its task. When V'Ger returned to the Sol system it could not find its creator, but "a biological infestation." The probe returned to the Borg homeworld and joined with them, and its programming propagated throughout the Collective. Something of a civil war broke out. Massive amounts of knowledge, including the location of Earth, were lost in the resulting conflict, and the Borg of the 24th century were born.
I think it's a bit of a stretch, but interesting considering that nothing is still known about the machine planet.
Star Trek: First Contact has a lot of general information about how the Borg became what they are today; basically, they began as a humanoid race seeking physical perfection, which they explored by developing and then integrating mechanical elements into their physiology. Eventually, the more mechanical elements came to dominate the biological. The Borg Queen states openly while interrogating Data that she considers the Borg's biggest weakness to be their remaining vestiges of humanity (humanoidity?), something that the Borg constantly strive to "transcend" as they assimilate and adapt (in contrast to Data, a sentient artifice who seeks to become more human). The movie however does not provide any specifics of timeline or of the name of the original race that became the seed of the Borg Collective. It seems they themselves have forgotten it as unimportant.
Speculation: In Star Trek: Voyager when they first meet the Borg, it is stated (maybe by Janeway) that the Borg only obtain new information by assimilation. They do not (or are not capable) of doing their own research (which is why Voyager is escorted across Borg space). I would assume that the Borg were at some point a primitive life form (it is not clear to me what the Borg actually are) which through practiced evolution through assimilation - and at some point they became technologically advanced (and therefore worthy of the name)
In the original script for Q, Who?, Guinan speaks to the origin of the Borg. She doesn't give us a full history, but she does indicate that they're ancient, at least 100,000 years old as a society/species.
GUINAN: They are a mixture of organic and artificial life that has been developed over a thousand centuries.
There is no EVIDENCE, but its believed that the Delta Quadrant is the origin of the Borg Collective. Neither is their biological origin. Its believed that they were an humanoid advanced civilization who grew tired of not being perfect. They want to achieve perfection, so they started assimilating species. The Vaadwaur were one of the first to encounter the borg, the borg had only assimilated only a handful of star systems.