Just an interesting topic and seems less known of that the Romans and Chinese had some diplomacy or trade directly at one point or another. How would they go about sailing there and back to Rome?
To put it plainly, we don't know, because the Chinese sources that record these visits don't describe the journeys they took to arrive in China. But they almost certainly entered the Indian Ocean through the Red Sea ports of Roman Egypt. There was a brisk trade between Rome and the west coast of India which passed through these ports, and Greco-Roman geographers (notably, Ptolemy) were aware of the Malay Peninsula, which they called "the Golden Chersonese", and of a gulf that lay beyond it. So the Roman visitors (if that is what they really were, and the Chinese records are not mistaken) almost certainly entered the Indian Ocean through Egypt and China through ports on what we would now call the South China Sea, and were likely to have stopped in Indian ports along the way. Alternatively, they may have been Roman merchants living in India, making their journey a great deal shorter.