Wouldn't Ansem SoD travelled to DI the same way any heartless travels anywhere: via corridors of Darkness? He was just more powerful than other heartless (since he is Xehanort's heartless) and probably was the first to sense or be attracted to Riku's darkness that had started to grow through his ambitions to leave DI.