Nobody really knows where the nids came from. It is almost certain that they came from an other galaxy, and it is heavily implied that they are running from something. They are converging on holy terra because they can see the astronomican.
An other theory is that they move mindlessly from galaxy to galaxy and just harvest everything in their path. GW aren't really moving forward this part of the storyline, so they are still pretty misterious.
The 7th edition codex retcons the "running from something" to maybe a single disposable line and instead focuses on them as the ultimate threat to the 40k galaxy, with the resources of other a thousand galaxies at their disposal in the most optimistic (for the natives of the galaxy) estimates; or are literally cosmic antibodies who have been at this since the dawn of time and have ended literally billions of galaxies at the most pessimistic.
Also, GW has been advancing the plot lately; Fenris has been destroyed, the Wolf Time has begun; the Adeptus Mechanicus is cutting a deal with the Dark Eldar to fix the golden throne, Commorragh is about to be consumed by a warp rift that's barely being contained; Gazghkull has left armageddon to gather the Octarius boyz while gork and mork still allow him to command the WAAAGH at Armageddon; Abaddon has moved past Cadia, new Necron dynasties are popping up everywhere, and even more tendrils of hive fleet leviathan are being detected at rates so extreme that many Eldar believe that the end is finally here. Ynnead is also confirmed to be real and is considering whether now is the time to kill Slaanesh before the galaxy dies. The Imperium even set a nebula surrounding tau space on fire to contain them. The Imperium is also making the unusual decision of giving up more and more planets and systems directly over to the Adeptus Astartes to directly rule over as the Imperium collapses to internal rebellion and external invasion.
All signs point towards 40k ending this decade. We've transitioned from Germany in the summer of 1944 to Germany in early 1945 in terms of hopelessness for humanity. It seems at this point; even the Emperor and all the Primarchs returning; the Eldar uniting under one leadership and allying with man, and the Tau making peace with man won't save the forces of order. The last possible hope would be Szarekh the Silent King offering mankind a devil's bargain for an unholy alliance, but overall it seems the forces of destruction shall stand triumphant. I mean, even the Orks think that there's going to be one last WAAAGH! that will either see the galaxy green or see everyone die.