The structural, electronic, magnetic, and optical properties of Co (6.25%) and Ni (6.25%) monodoped and co-doped GaN were calculated by the DFT+U method using a 2 × 2 × 2 supercell of a total of 32 atoms. The formation energy was negative under both Ga-rich and N-rich conditions for all structures. N-rich condition is found to be favorable for GaN growth. The electronic and magnetic properties changed after doping due to the transition of the 3 d states of Ni, Co and hybridization of 2p of N. Hence monodoped GaN is ferromagnetic whereas the co-doped one is ferrimagnetic due to partial cancellation by the opposite spin of Ni and Co. The doped and co-doped absorption peaks are blue-shifted in the ultraviolet (UV) and redshifted in the visible-infrared (VIS-IR) region from the peaks of pure GaN. A pronounced absorption of VIS-IR is observed in monodoped structures. Both dielectric constant and refractive index increased due to co-doping whereas monodoping had enhanced the properties significantly. This theoretical study suggests the potential application of the Co, Ni monodoped in VIS- IR photonic and co-doped GaN in spintronic devices.