How did a satellite galaxy of the Milky Way come to be?