How did Alluka Zoldyck obtain her powers?
It has been confirmed that Nanika came from the Dark Continent and evidence suggests that Nanika is Ai, the desire of co-dependence.

As to how Nanika started possessing Alluka, we don't know for sure but seeing how Zigg Zoldyck went to the Dark Continent, it is possible he brought it back to the outside world.