I know that there is something to do with the vapour pressure of pure water being higher than the vapour pressure of the sugar solution, but I still can’t really explain what happens on a molecular level. Could someone help?
Water molecules in gas phase collide and are absorbed by both solutions at the same rate, assuming the same humidity over the solutions.
OTOH, as sugar solution has lower molar fraction of water than water itself, its rate of water evaporation is lower than pure water evaporation.
Therefore, there is the net transfer of water molecules from the water beaker to the sugar solution beaker.
It can be formulated also by other way: The saturated vapor pressure over sugar solution is lower than over pure water. Therefore vapour saturated over water is oversaturated over sugar solution. And vice versa - vapor saturated over sugar solution is undersaturated over water.
The water goes to the sugar beaker spontaneously, be careful for this word, in that you don't make any effort to move it there except only connecting the two beakers. Any spontaneous process have a negative free energy. The negative free energy is the result of comparing the energy state of the system before the process (water only beaker) and the energy state after the process (water mixed with sugar in the second beaker). That is, systems in nature like to decrease their energy state.
What happens at the molecular level is that water molecules makes favorable hydrogen bonds with sugar molecules thus decreasign the enthalpy of the system and increase the disorder of the system of water molecules by mixing with sugar thus increasing the Entropy of the system. Both effects reults in decease in the energy state of the system and favoring the water sugar situation.