In this work, the electronic structure and magnetic properties of GdNiSi have been investigated within the framework of theoretical DFT + U method. The antiferromagnetic ordering of the Gd moments was obtained as the ground state, whereas Ni and Si have negligible magnetic moments. An antiferromagnetic-to-ferromagnetic transition was found when GdNiSi is doped with Al in our theoretical calculations. The antiferromagnetic-to-ferromagnetic transition takes place in the Gd sublattice, the magnetic moments at the Gd ions remain the same but the type of magnetic ordering changes. It was found that even at concentrations as low as x = 0.1, the ferromagnetic ordering in the Gd sublattice is more favorable in total energy as the ground state which can be ascribed to the shortening of Gd-Gd distances and the oscillating behavior of the Ruderman–Kittel–Kasuya–Yosida interaction in the Al-doped compositions. The electronic structure demonstrates significant changes in the vicinity of the localized Gd 4f states that confirms the presence of the antiferromagnetic-to-ferromagnetic transition using our theoretical results for Al x$$ \geqslant $$ 0.1 in good agreement with the previous experimental magnetic results.