In the 2370s, Starfleet commissioned Doctor Lewis Zimmerman, the leading expert on holotechnology, to create a tiny spy hologram for the "Trojan Horse Project". Roy, being small enough that no one would notice, was successful. He was then given back to Jupiter Station, where Dr. Zimmerman kept him as a pet.
Haley was always telling Roy to stay off the food, especially Doctor Zimmerman's salad. In 2376, when The Doctor came to the Alpha Quadrant to treat Doctor Zimmerman for a fatal disease, he got so annoyed that he smashed a book on Roy. (VOY: "Life Line")