In recent years, the lattice Boltzmann (LB) method has been widely employed to simulate boiling phenomena [A. Markus and G. Hazi, Phys. Rev. E 83, 046705 (2011); Biferale et al., Phys. Rev. Lett. 108, 104502 (2012); Li et al., Phys. Rev. E 96, 063303 (2017); Wu et al., Int. J. Heat Mass Transfer 126, 773 (2018)]. However, a very important issue still remains open, i.e., how does boiling occur in the LB simulations? For instance, the existing LB studies showed that the boiling on a hydrophobic surface begins at a lower wall superheat than that on a hydrophilic surface, which qualitatively agrees well with experimental studies, but no one has yet explained how this phenomenon appears in the LB simulations and what happened in the simulations after changing the wettability of the heating surface. In this paper, the LB boiling mechanism is revealed by analyzing boiling on a flat surface with mixed wettability and boiling on a structured surface with homogeneous wettability. Through a theoretical analysis, we demonstrate that, when the same wall superheat is applied, in the LB boiling simulations the fluid density near the heating surface decreases faster on a hydrophobic surface than that on a hydrophilic surface. Accordingly, a lower wall superheat can induce the phase transition from liquid to vapor on a hydrophobic surface than that on a hydrophilic surface. Furthermore, a similar theoretical analysis shows that the fluid density decreases fastest at concave corners in the case of a structured surface with homogeneous wettability, which explains why vapor bubbles are nucleated at concave corners in the LB simulations of boiling on structured surfaces.