The Riku Replica's first and only appearance was in Kingdom Hearts: Chain of Memories. He was created by Vexen of Organization XIII. He was killed by the real Riku in that same game.
Beginning
The Riku Replica was created by Vexen to test the real Riku's power and if possible hoax Riku into turning to the darkness. However the Riku replica this early on in his life (though he looked just real Riku and had the power of darkness on his side) to be capable of defeating the real Riku. After this battle, however, Vexen took the replica above ground.
Sora battles
When Vexen took the Riku replica above ground to face Sora and (in the Replica's plans) to train him to be able to defeat the real Riku. However at the suggestion of Larxene, the Replica's memories were rewritten to resemble the real Riku's (though the Replica objected to this idea.) The replica fought Sora four times before Naminé finally stopped him from killing Sora after the end of the fourth battle by breaking his heart. At this moment Larxene revealed the truth. The Replica was out for a little while and did not reappear until Marluxia was threating Naminé and Sora. He aided Sora during the battle and then agreed to watch Naminé while Sora, Donald, and Goofy fought Marluxia. After Sora told him that it didn't matter if he was a fake Riku because he had his own heart. The replica seems to have been rather touched by Sora's words. However, meeting up with Axel after he left Sora, he still had one thing left to do: Defeat the real Riku.
Riku Replica VS Riku
Under Axel's notion that Riku must need more power to he could defeat the real Riku, the Replica killed Zexion to take the power he thought was needed to finally kill Riku. However, Riku's power had grown as well. He now used the power of darkness with no resentment. The two fought ferociously but in the end the real Riku prevailed. In the end the replica aknowledged what he had known from the start: He was just a copy and did everything Riku did.
He is based on the Dark form of Riku that was fought against by Sora in Kingdom Hearts prior and after being possessed by Ansem), and played as through Riku's story in Chain of Memories, which in this case is an entirely different entity than the Riku replica.