Roxas came to be as a part of Sora, and his story is closely tied to the events of the first Kingdom Hearts.
As you'd see if you played KH1, Sora temporarily turned into a Heartless. When that happened, he was strong enough that he also produced a Nobody—Roxas. According to Naminé, Roxas was needed in order to make Sora whole again. It's a poignant piece of the series' intricate lore.