Gallium oxide (Ga2O3) has attracted much attention for its ultra-wide band gap and superior optoelectronic properties in the field of ultraviolet (UV) photodetectors. However, Ga2O3-based photodetectors still face problems such as slow response speed, large dark current and high power consumption. In this work, we design an n-Ga2O3/p-GaN vertical heterojunction in a transverse device and use it to construct a high-performance UV photodetector. The GaN film directly connects to the electrodes, while the Ga2O3 nanowires cover the top surface of the GaN and do not contact with any electrode. Based on this unique heterostructure, the photodetector demonstrates a low dark current and fast photoresponse speed under 254 nm irradiation. On the other hand, the photodetector can be operated at 0 V bias due to asymmetric Schottky barriers caused by the difference in electrode size. The photoresponse, specific detectivity and photoresponse speed of the photodetector are calculated to be 44.98 mA/W, 5.33 × 1011 Jones and 383 ms, respectively, under self-powered mode. The enhanced UV photoresponse and self-powered mechanism of the photodetector are discussed in detail via the schematic diagrams of energy band structure and carrier transport process. At last, a vivid image is obtained using the Ga2O3/GaN photodetector as an imaging pixel in the imaging system. This work provides an effective strategy to construct high-performance UV photodetectors toward optical imaging.