It is not explicitly explained, but the command was presumably issued by Trillian's two pet mice, Benjy and Frankie. Shortly before the ship landed on Magrathea the two mice escaped:
Trillion burst in through the door from her cabin.
“My white mice have escaped!” she said.
An expression of deep worry and concern failed to cross either of
Zaphod’s faces.
“Nuts to your white mice,” he said.
The party then leave the ship, and eventually reconvene at a dinner party where the mice are already present, "sitting in what looked like whisky glasses on the table."
In order to have arrived there, they would have had to have left the ship after the others had gone. And as "vast hyperintelligent pan-dimensional beings" they would have had no problem in commanding Eddie, whose surprise was presumably that he had no previous idea of the mice's true nature.