An origin was given for Dark Link in FSA. He was created by the Dark Mirror when Link looked into it. It creates a shadowy copy of whoever looks into the mirror made out of the wickedness within them.
"That mirror reveals the wickedness within a person and brings it to life. It's an item of terrible, dark power. No good can come from this. Shadow Link!! Could he be your evil reflection, cast by the Dark Mirror?" — White Maiden
As for him appearing in the Water Temple of OoT, I equate that to Link fighting Phantom Ganon earlier in the Forest Temple. Link already overcame a dark copy of Ganondorf, showing that Link might have the ability to overcome him. But could Link overcome himself? Even Navi mentions this,
"Dark Link Conquer yourself!" — Navi
This is similar to Shadow Link's purpose in AoL, that he was the final challenge for the true hero to see if they are worthy of the Triforce of Courage. Many strong individuals can overcome the temples and defeat the monsters within, even the bosses in them. But not everyone has the ability to overcome their own wickedness and dark emotions within themselves and come out on top. This proved Link was truly worthy. It is this capability to take one's own dark reflection and give it life that makes things like
Morpha was already mentioned as the reason behind the frozen Zora's Domain, so Ganondorf needed it to remain there to control the waters of Hyrule.
"This ice is created by an evil curse... The monster in the Water Temple is the source of the curse." — Sheik
But Dark Link appears suddenly within the temple, almost as an after thought. He has no real introduction or purpose. But he could have been hastily made by Ganondorf to stop Link from making it to Morpha and undoing the curse on Zora's Domain. Another thing to consider is that Dark Link was guarding the long shot inside the temple. An item that very easily defeats Morpha. Ganondorf would want that guarded if he knew of it's location. The way I see it, Morpha was necessary to control the waters of Hyrule, and Dark Link was specifically created to stop Link from continuing his quest and awakening the sage.
its probably because, of how water reflects a person and dark link is the opposite reflection of link. The story of dark link may be solved in Aol.
This is an interesting interpenetration, Ganondorf could have used his mastery over the water temple to create a dark reflection of Link within that room. Dark Link did seem to disappear back into the water sometimes and then pop back out. The cursed waters might have had a similar effect to the dark mirror of FSA. The reflection was brought to life made from the wickedness deep within Link.