The atomic structure model of symmetric [0001] tilt boundary of α phase in magnesium alloy was set up by using the concept of coincidence-site lattice (CSL). The segregation energies of impurities, the interaction energies between impurities and fermi levels of different systems at grain boundary (GB) were calculated by using recursion method. The segregation behaviour of impurities, the relationship between the interaction between impurities and the ordering tendency, as well as the physical nature of the influence of impurities on corrosion resistance of magnesium alloy were discussed. Calculation results show that impurity atoms segregate to GB, and are apt to occupy the sites in the compressed region of GB. Impurity atoms repel each other, therefore form ordered phases in the region of GB. The relationship between the fermi level of a kind of material and its equilibrium potential is: the higher the fermi level is, the lower the equilibrium potential is; and vice versa. The difference of fermi level of regions with different composition in a system leads to the flow of electrons from the region with high fermi level to the region with low fermi level. It is just the difference of fermi levels that forms the electrodynamic force of the electrochemical corrosion in magnesium alloys.