In the given situation, the gas is heated under constant volume. As energy is supplied to the system in the form of heat, the frequency of collision between the gas particles increases. This increases the temperature of the gas consequently bringing about a decrease in pressure.
Based on the ideal gas law:
PV = nRT
Here, P/T = nR/V
If P1, T1 and P2, T2 are the pressure and temperature values before and after heating respectively, then since nR/V is a constant in this case, we have
P1/T1 = P2/T2 which is the Gay-Lussac's law.