In this work, gallium nitride (GaN) thin film was deposited on porous silicon (PSi) substrate via a pulsed laser deposition route with a 355 nm laser wavelength, 900 mJ of laser energy, and various substrate temperatures raging from 200 to 400 °C. The structural and optical properties of GaN films as a function of substrate temperature are investigate. XRD studies reveal that the GaN films deposited on porous silicon are nanocrystalline with a hexagonal wurtzite structure along (002) plane. The photoluminescence emission peaks of the GaN/PSi prepared at 300 °C substrate temperature are located at 368 nm and 728 nm corresponding to energy gap of 3.36 eV and 1.7 eV, respectively. The GaN/PSi heterojunction photodetector prepared at 300 °C exhibits the maximum performance, with a responsivity of 29.03 AW−1, detectivity of 8.6 × 1012 Jones, and an external quantum efficiency of 97.2% at 370 nm. Similarly, at 575 nm, the responsivity is 19.86 AW−1, detectivity is 8.9 × 1012 Jones, and the external quantum efficiency is 50.89%. Furthermore, the photodetector prepared at a temperature of 300 °C demonstrates a switching characteristic where the rise time and fall time are measured to be 363 and 711 μs, respectively.