This confusion is A Thing. I actually looked into it a few weeks back.
Its quite likely that ancient Indians were the first people to harvest and make use of saltpeter. We certainly haven't found definitive record of anyone doing so earlier. It was mentioned in The Arthashastra, which was compiled between -300 and 300. Saltpeter is a great fertilizer, and the Gupta Empire encompassed two of the worlds most fertile river valleys, so this would certainly have been its primary use. The military use they reported putting it to was limited to burning it to produce a noxious gas.
Saltpeter is a component of gunpowder, but it is not the only component. The process to produce gunpowder involves the use of saltpeter, sulfur, and carbon. So gunpowder and saltpeter are not the same thing, in roughly the same way that flour and a blueberry pie are not the same thing.
The earliest reference we have to something like gunpowder is from alchemist Wei Boyang of the Eastern Han in 142 AD. We don't know if he invented gunpowder, or just documented it. There are several more mentions of it from Chinese sources over the centuries, but the first in a military context is from a Chinese military manual in 1044.
Now on some level one can understand the confusion here, as not everybody has the level of chemical knowledge to know the difference between saltpeter and gunpowder. However, if most of the sources making this mistake come from people who share a political motivation, one starts to ponder the line between incompetence and malice. Either way, its good mental hygiene to avoid information sources prone to making such errors without ever correcting them.