In semiconductor heterojunction, polarity critically governs the physical properties, with an impact on electronic or optoelectronic devices through the presence of pyroelectric and piezoelectric fields at the active heteropolar interface. In the present work, the abrupt O-polar ZnO/Ga-polar GaN heterointerface was successfully achieved by using high O/Zn ratio flux during the ZnO nucleation growth. Atomic-resolution high-angle annular dark-field and bright-field transmission electron microscopy observation revealed that this polarity inversion confines within one monolayer by forming the (0001) plane inversion domain boundary (IDB) at the ZnO/GaN heterointerface. Through theoretical calculation and topology analysis, the geometry of this IDB was determined to possess an octahedral Ga atomic layer in the interface, with one O/N layer symmetrically bonded at the tetrahedral site. The computed electronic structure of all considered IDBs revealed a metallic character at the heterointerface. More interestingly, the presence of two-dimensional (2D) hole gas (2DHG) or 2D electron gas (2DEG) is uncovered by investigating the chemical bonding and charge transfer at the heterointerface. This work not only clarifies the polarity control and interfacial configuration of the O-polar ZnO/Ga-polar GaN heterojunction but, more importantly, also gives insight into their further application on heterojunction field-effect transistors as well as hybrid ZnO/GaN optoelectronic devices. Moreover, such polarity control at the monolayer scale might have practical implications for heterojunction devices based on other polar semiconductors.