A complementary computational and experimental study of the reactivity of Lewis acidic CrCl2, CuCl2 and FeCl2 catalysts towards glucose activation in dialkylimidazolium chloride ionic liquids is performed. The selective dehydration of glucose to 5-hydroxymethylfurfural (HMF) proceeds through the intermediate formation of fructose. Although chromium(II) and copper(II) chlorides are able to dehydrate fructose with high HMF selectivity, reasonable HMF yields from glucose are only obtained with CrCl2 as the catalyst. Glucose conversion by CuCl2 is not selective, while FeCl2 catalyst does not activate sugar molecules. These differences in reactivity are rationalized on the basis of in situ X-ray absorption spectroscopy measurements and the results of density functional theory calculations. The reactivity in glucose dehydration and HMF selectivity are determined by the behavior of the ionic liquid-mediated Lewis acid catalysts towards the initial activation of the sugar molecules. The formation of a coordination complex between the Lewis acidic Cr2+ center and glucose directs glucose transformation into fructose. For Cu2+ the direct coordination of sugar to the copper(II) chloride complex is unfavorable. Glucose deprotonation by a mobile Cl- ligand in the CuCl42- complex initiates the nonselective conversion. In the course of the reaction the Cu2+ ions are reduced to Cu+. Both paths are prohibited for the FeCl2 catalyst.