Why is methyl α-D-glucopyranoside preferentially formed from glucopyranose in acidic methanol?
In general, if there is overlap between a filled orbital and an unfilled orbital, a stabilising interaction will take place between the two. A simple example is the resonance present in esters, where the ester oxygen lone pair (a filled orbital) overlaps with the C=O π* orbital (an unfilled orbital):



In this context, anomer refers to a diastereomer differing only in the configuration at C-1. So, the two diastereomeric products you have drawn above are often called the α and β anomers.

In the α anomer, there is one lone pair on the ring oxygen (a filled orbital) which can overlap with the C–OMe σ* orbital (an unfilled orbital):



This leads to a stabilisation of roughly 6 to 7 kJ/mol, and is called the anomeric effect.

In the β anomer, neither of the two lone pairs on the ring oxygen overlap well with the C–OMe σ*.



Of course, steric effects would disfavour the α anomer, which possesses an axial methoxy group. However, this factor only leads to a destabilisation of roughly 3 to 4 kJ/mol, and is therefore outweighed by the stereoelectronic stabilisation provided by the anomeric effect.

The rough numbers are taken from Kirby, A. J. Stereoelectronic Effects (OUP), p 16.



While the lone pair -> σ* explanation is the most commonly invoked, there are also likely to be other factors that are also present: for example, in the α anomer, the dipole moments of the ring oxygen lone pair and the exocyclic C–O bond oppose each other, which is a favourable electrostatic interaction: