The positively charged Mg++ interacts with negatively charged phosphate oxygen atoms of ATP, providing charge compensation and promoting a favorable conformation of ATP at the active site. (See also diagram p. 585.)
The reaction catalyzed by Hexokinase is highly spontaneous. A phosphoanhydride bond of ATP (~P) is cleaved. The phosphate ester formed in glucose-6-phosphate has a lower DG of hydrolysis.