The stability and growth or dissolution of a single surface nanobubble on a chemically patterned surface are studied by molecular dynamics simulations of binary mixtures consisting of Lennard-Jones (LJ) particles. Our simulations reveal how pinning of the three-phase contact line on the surface can lead to the stability of the surface nanobubble, provided that the concentration of the dissolved gas is oversaturated. We have performed equilibrium simulations of surface nanobubbles at different gas oversaturation levels ζ > 0. The equilibrium contact angle θe is found to follow the theoretical result of Lohse and Zhang (Phys. Rev. E 2015, 91, 031003(R)), namely, sin θe = ζL/Lc, where L is the pinned length of the footprint and Lc = 4γ/P0 is a capillary length scale, where γ is the surface tension and P0 is the ambient pressure. For undersaturation ζ < 0 the surface nanobubble dissolves and the dissolution dynamics shows a “stick-jump” behavior of the three-phase contact line.