Unsatisfactory corrosion resistance is one of the major disadvantages of magnesium alloys that impede their wide application. Microstructural changes, especially grain sizes, of Mg alloys have significant influence on their corrosion resistance. Cryogenic machining was reported to effectively induce grain refinement on Mg alloys and has a potential to improve their corrosion resistance. It is important to model these changes so that proper machining conditions can be found to enhance the corrosion rate of Mg alloys. In this paper, a preliminary study was conducted to model the microstructural changes of AZ31B Mg alloy during dry and cryogenic machining using the finite element (FE) method and a user subroutine based on the dynamic recystallization (DRX) mechanism of Mg alloys. Good agreement in terms of grain size and affected layer thickness was found between experimental and predicted results. A numerical study was conducted using this model to investigate the influence of rake angle on microstructural changes after cryogenic machining.