From Halopedia, the Halo wiki
The Infinite Shotgun is a glitched Shotgun dropped by an NPC in the Halo 2 Campaign level The Great Journey. The weapon has infinite ammo when picked up, but it can be used to refill a different Shotgun infinitely.
When you reach the point where Sergeant Johnson blows open the Control Room with a stolen Scarab, go inside, kill all of the Brutes present, and grab a Shotgun from one of the bodies. Make sure to also grab a couple of Anskum-pattern plasma grenades.
Go into the next room and watch the cutscene in which Tartarus tries to force Miranda Keyes to activate the Halo. Once the cutscene ends, find the Brute that holds a Shotgun and stick him with a Plasma Grenade. Make sure he drops his weapon and tries to charge at you before the grenade detonates. Now reload your Shotgun and walk over the dropped Shotgun to collect more ammo. You can return to it at any time to refill your Shotgun.