The photocatalytic performance of Nb,N-codoped TiO2 nanoparticles obtained via the sol–gel method was compared to that of N-doped TiO2. The study focused on investigating the effects of nitridation conditions on nitrogen insertion with a highlight on the nature of the doping sites in the photocatalyst depending on the initial presence of niobium in the TiO2. The photodegradation of methylene blue in solution under UV, visible, and simulated solar light was used to evaluate the photocatalytic activity of TiO2, Nb- or N-doped TiO2, and Nb,N-codoped TiO2 nanoparticles. Codoped TiO2 produced by mild thermal nitridation exhibits the best photocatalytic activity, with a strong contribution from visible light. On the contrary, the codoped TiO2 produced by more intense thermal nitridation presents lower photocatalytic performances than TiO2 despite a small improvement of activity in the visible range. In addition to material characterization (X-ray diffraction, UV–vis spectroscopy, and X-ray photoelectron spectroscopy), electron paramagnetic resonance and reversed double-beam photoacoustic spectroscopy measurements were used to identify the respective doping sites and ultimately propose the electronic band structure for each sample of Nb:TiO2, N:TiO2, and Nb,N:TiO2. Proper thermal nitridation conditions improve the charge compensation between Nb5+ and N3–, thereby enhancing the photocatalytic activity. However, too intense nitridation conditions led to the generation of oxygen vacancies and a large amount of Ti3+ acting as charge recombination centers, resulting in significant deterioration of the photocatalytic performances. This study highlights the importance of understanding the intricate charge compensation process in codoped (M,N) TiO2 materials, as the photocatalytic performance cannot be elucidated solely by the cation/anion ratio but also by considering the nature of the doping sites generated during synthesis.