The precipitation of magnesium oxide (MgO) from the Earth's core has been proposed as a potential energy source to power the geodynamo prior to the inner core solidification. Yet, the stable phase and exact amount of MgO exsolution remain elusive. Here we utilize an iterative learning scheme to develop a unified deep learning interatomic potential for the Mg-Fe-O system valid over a wide pressure-temperature range. This potential enables direct, large-scale simulations of MgO exsolution processes at the Earth's core-mantle boundary. Our results suggest that Mg exsolve in the form of crystalline Fe-poor ferropericlase as opposed to a liquid MgO component presumed previously. The solubility of Mg in the core is limited, and the present-day core is nearly Mg-free. The resulting exsolution rate is small yet nonnegligible, suggesting that MgO exsolution may provide a potentially important energy source, although it alone may be difficult to drive an early geodynamo. The paleomagnetic records suggest that the Earth's magnetic field dates back to at least 3.4 billion years ago. Yet, the energy source of this early geodynamo is still puzzling. One popular hypothesis is that buoyant magnesium oxide may exsolve out of the Earth's core as the core cools, releasing gravitational potential energy to drive the core convection and power the early geodynamo. However, the amount of MgO exsolved is uncertain due to experimental and computational challenges. Here, for the first time, we directly simulate the MgO exsolution processes using large-scale molecular dynamics simulations, made possible by interatomic potentials built upon machine learning methods. The results show that MgO exsolve as a component of a crystalline ferropericlase, in contrast to early studies which generally assume that MgO exsolve as a component of silicate melts. We find that MgO solubility in the core is low. The exsolution rate is small and MgO alone may be insufficient to sustain a long-lasting magnetic field at the Earth's surface in its early history. A machine learning potential of ab initio quality is developed for the Mg-Fe-O system Mg exsolve in the form of crystalline Fe-poor ferropericlase with a small exsolution rate assuming only Mg and O are present in the core MgO exsolution may serve as an important source of buoyant flux to drive the early geodynamo