Ring opening of epoxides
If you think about the quantities involved in this reaction, you'll realize why does the product contain the methoxy group and not the halide. Methanol is present in large excess since it is the solvent of this reaction. Cl- ions will also be present and a very small amount of the chlorohydrin may be formed as well. The reason why methanol is a reagent and not only act as a solvent in this reaction is because its oxygen atom acts as a nucleophile, just like halides or any other molecule containing electronegative atoms (such as O, N, S etc).

I found the following mechanism on Google and it is draw as if the reaction was being performed in water, however you can replace the blue water molecule for methanol or any other alcohol since the mechanism is the same for both.



Whenever you look at a reaction schemes like the one you've posted, you should always address the reactivity of solvents and other reaction components, sometimes they end up reacting with your substrate rather than your desired reagent, this is a very good example of it. So if you intend to synthesize a chlorohydrin, you cannot use a nucleophilic solvent, otherwise, it will react with the epoxide and form the correspondent adduct.

I hope this answers your question.