(Note: Due to the limited data on what the Borg consider their history this is more a history of Borg/Federation relations.)
The origins of the Borg are unknown, what is known is that they existed at least 800 years ago. Where they came from is hotly debated among the ranks of Starfleet. Admiral CTerry supports the so-called 'army' theory where the Borg were created as an invincible army to protect their planet who assimilated enemies and made their army larger. One day, I believe, they developed the Borg philosophy of today and assimilated their creators. However of course this is just a theory that fits the facts particularly well with no real evidence.
The first Borg contact with the Federation happened in late 2364. Federation Colonies along the neutral zone between the Federation and Romulan Empire went missing although originally suspected to be due to Romulans the Borg were found responsible at the time of First Contact with the Borg. However the Borg attacks also brought the Romulans out of isolation meaning the Borg are indirectly responsible for years of Romulan threats. Borg first contact actually happened the following year. The entity known as Q appeared aboard the USS Enterprise-D and threw the ship through space into the Delta Quadrant where the Borg resided, there the Enterprise was pitted against a Borg Cube, tearing it apart however the Borg soon adapted to Federation weapons fire the and the Enterprise found itself running from the cube, eventually Q returned them to Federation space, the news of the Borg rattled the Federation and almost immediately work began on new weapons systems and new ship classes, unfortunately despite this the Federation was not prepared for the attack when it came in 2366, the Cube that came assimilated countless lives, attacking colonies and destroying a fleet of forty starships, both Federation and two from the Klingon Empire, the Borg were relentless. They assimilated Captain Jean-Luc Picard of the USS Enterprise and used him as a representative for themselves renaming him Locutus of Borg. The crew of the Enterprise distracted the Borg while one of their shuttles headed into the cube where they recaptured Picard. The Cube continued towards Sector 001. The crew of the Enterprise used Locutus to gain access to the collective, although they found most commands were locked out. Upon a suggestion from Picard (and not Locutus) of 'sleep' Data ordered the entire collective to go into 'regeneration mode' stopping the attack and allowing the crew to destroy the marauding cube. The Federation was safe... for now. The following year the Enterprise discovered a lot of what is known about Borg anatomy. It was late 2368 and the Enterprise was in the Archanis Cluster when it discovered a crashed Borg scout cube. One of the occupants was still alive, Third of Five, a Borg adolescent. The crew studied him, learning from him and they discovered a way to destroy the Borg, an unsolvable geometric shape which would destroy the collective. However Enterprise crewmembers, including Lieutenant Commander Geordi La Forge, the Chief Engineer, became attached to the young Borg who they dubbed 'Hugh'. The crew of the Enterprise decided it was unethical to destroy the Borg collective, after that would be genocide on the grandest of scales. Hugh was returned to his people. Starfleet Command blasted Picard for this, seeing it as maybe their only chance against an unbeatable enemy. Hugh's sense of individuality was transferred to his local group of Borg by the collective. The concept was so alien it leaved them lost. disorientated and unable to function on their own. The android Lore found them, however, and assumed the role of leader. At the end of 2369 Lore ordered the altered Borg to attack. At Ohniaka III Enterprise crew fought the modified Borg, surprised by the fact that they seemed to be individuals. One of the Borg, Crosis of Borg, was captured. He tempted Lieutenant Commander Data with emotions, something Data had always wanted above all else. Stealing a shuttle the two used a Transwarp conduit to get to the Delta Quadrant, the Enterprise managed to open one of these conduits and followed the shuttle. In the Delta Quadrant they found a Borg stronghold. A planet wide search revealed Data but it was discovered he had defected to the new Borg and the away team was captured. It was learned that Lore was using an emotion chip he stole from his creator Dr. Soong to manipulate both the Borg and Data. The captured Enterprise crewmen escaped, and the skeleton crew aboard the Enterprise, led by Dr. Beverley Crusher, managed to destroy their vessel. The Enterprise crew on land managed to get help from Borg which had resisted Lore, led by Hugh, and managed to deactivate Lore, permanently. However the Federation new the Borg would come again and that day was coming. In 2373 that day arrived, the Cube attacking Earth was relentless, even though the Federation was better prepared for them this time. Despite orders to patrol the Neutral Zone the new USS Enterprise-E arrived at the battle. Picard used his residual link to the collective to explode a weakness in the Cube and it was destroyed. However the Borg weren't finished yet, a Sphere launched from inside the Cube and activated a temporal distortion allowing it to travel back to 2063, however the Enterprise managed to follow it. The Sphere tried to destroy the missile complex where Zephram Cochrane was building the Phoenix, Earth's first warp-capable ship, in an attempt to stop First Contact with the Vulcans. The Enterprise managed to destroy the Sphere. However the Borg had yet more tricks up their sleeve and transported onto the Enterprise's lower decks with an undetectable transporter beam. They started to assimilate the ship deck by deck. Meanwhile Enterprise crewmen attempted to repair the Phoenix. The Borg got to Deflector control where they began to modify the deflector to communicate with the Borg of that century. Fortunately Enterprise crew stopped them, but the Borg had yet another plan. They continued their assimilation and began to manipulate the captured Data. Picard ordered the self-destruct mechanism and ordered the crew to evacuate but he went to save Data. The Borg Queen was in the room with Data and ordered him to deactivate the lock outs on weapon control and fire on the Phoenix. Data appeared to do so until the torpedoes he fired went past the Phoenix. With a scream of "Resistance is Futile!" Data knocked open one the plasma coolant tanks which vaporised all living flesh, Picard managed to get to a safe place and the Queen was dead.... for now. Around this time the Borg discovered the so-called fluidic space and the species that lived there- whom the Borg deemed Species 8472. Biologically speaking 8472 was an amazing race, able to survive a direct hit from a Borg weapon they resisted in a way the Borg had never seen before. Their weaponry could not be adapted too and they could not be assimilated. At the end of that year the USS Voyager, lost in the Delta Quadrant, had to pass through Borg space, they soon discovered the war between the Borg and 8472 and indeed decided that 8472 was by far the more dangerous race. Discovering a way to use modified Borg nano-probes against 8472. They made a temporary alliance with the Borg to find a way to use them against 8472 ships. Working with Borg Seven of Nine, Tertiary Adjunct to Unimatrix 01 the crew made progress, that is until an 8472 ship attacked. In order to protect Voyager the Borg Cube they were travelling with had to kamikaze the vessel. Transporting to Cargo Bay 2 the Borg used the cargo bay for their work. However XO Commander Chakotay, who was in temporary command of the vessel broke off the alliance and jettisoned the Borg into space all except Seven of Nine who managed to hold on just long enough. She re-programmed the ship's deflector and the vessel found itself in fluidic space. CO Captain Janeway back in command of the vessel ordered the vessel to be refitted with Borg technology. With the new nano-probes placed in torpedoes ready for attack Voyager readied itself for battle. 8472 attacked but Voyager was able to destroy their vessels and 8472 evacuated our Galaxy. However almost immediately Seven of Nine attempted to assimilate Voyager, however Voyager attempted to disconnect her from the hive mind. The Borg decided to allow just that and disconnected her themselves. Seven was left on Voyager. In early 2375 there was a transporter accident on Voyager. The crew's holographic doctor, had a 29th Century mobile holo-emitter. This emitter bonded with some of Seven of Nine's nano-probes resulting in a 29th Century Borg named 'One'. One learned about Federation values and when the Borg came to make him part of the collective One sacrificed himself to save them. Later that year on Stardate 52619.2 the crew of Voyager planned a 'heist' to steal a Transwarp coil which would shave 20 years off Voyagers journey. During the heist Seven remained on the Sphere from which they were stealing the coil and went to Unimatrix 01 aboard it. The Queen planned to use Seven to help assimilate Earth. Janeway beamed into the chamber where they were and managed to escape with Seven back to Voyager. However the Transwarp coil broke soon after use. In mid 2376 Ensign Harry Kim, Commander Chakotay, Crewman Neelix and Lieutenant Tom Paris of Voyager were taken hostage. Although it turned out their captors were just children and adolescents they were dangerous. However Seven of Nine eventually managed to convince them to join Voyager's crew. At the end of 2376 Seven had a rather unsettling experience. She started dreaming of a place known as Unimatrix 0. Apparently it was a mutation in some drones which allowed them to go to this place while they regenerated, a sort of dreaming in a way. There they were free of the collective but now the collective had discovered Unimatrix 0 and began to attack it. Apparently while Borg Seven had come here. The crew began a daring plan. Janeway, the chief Engineer, Lt. Torres and security officer Lt. Commander Tuvok infiltrated a Type-4 tactical cube where they were assimilated. However via a neural suppressant they weren't connected to the collective itself. Eventually they managed to free all the Unimatrix 0 drones so they were permanently individuals. Voyager managed to get their crew back and the Borg collective had a new enemy among it's ranks. At the end of 2377 Admiral Janeway from the future appeared on Voyager convinced to get her old crew home. She gave Voyager transphasic torpedoes and an ablative armour generator which they then used to navigate a nebula and use a Borg Transwarp hub to get home. Admiral Janeway on the other hand visited the Borg Queen at Unimatrix 01. She was assimilated but a virus was in her blood which infected the queen and the collective resulting in the known destruction Unimatrix 01, the Transwarp hub that Voyager used was also destroyed. It is not known how much destruction occurred, different people have different theories. Some believe that some Borg may of been able to disconnect from the hive mind and create a new collective. Some believe the Borg are gone forever. However the Borg are highly adaptive, one day we may be going about are business and hear the words: "Resistance is Futile..."