The tail gun of the B-58 boasted many firsts for an aircraft defensive gun including the first fully automatic defensive gun fire control system
The U.S. Air Force’s first operational supersonic bomber, the B-58 made its initial flight on Nov. 11, 1956.
The four engine delta winged aircraft was the world’s first bomber designed to sustain supersonic speeds during its mission profile. In addition to the Hustler’s delta wing shape, distinctive features included a sophisticated inertial guidance navigation and bombing system, a slender “wasp-waist” fuselage and an extensive use of heat-resistant honeycomb sandwich skin panels in the wings and fuselage and the first fully automatic defensive gun fire control system.
As JP Santiago explains in an interesting article appeared on his website Tails Through Time, the Convair B-58 Hustler’s tail cone that enclosed the tail gun was composed of tapered, concentric aluminum rings nested within each other and spring-loaded against each other to form a flexible aerodynamic shell for the gun system.
After looking at various options including rear-firing missiles and twin 30mm cannons, the General Electric T171 (first designation of the M61 Vulcan cannon) 20mm rotary cannon was selected in early 1954. According to Jay Miller’s book Convair B-58 Hustler: The World’s First Supersonic Bomber, the tail gun of the B-58 boasted many firsts for an aircraft defensive gun including the first fully automatic defensive gun fire control system for a production aircraft, the first aircraft gun unit to use a 3-axis inertially-stabilized platform to increase the gun’s accuracy, the first aircraft gun to use a self-contained environmental control unit for the gun and ammunition storage, first aircraft gun to use a solid state analog fire control computer for fire control and the first to use a hinged turret arrangement for maintenance work.
The forward muzzle velocity of the 20mm T171 cannon was lower than the forward velocity of the B-58 when it was flying at Mach 2. So relative to the ground, the cannon round would be moving backwards when leaving the muzzle!

Photo credit: U.S. Air Force
Not sure where you do your research, but the M-61 fires at 3450 FPS. Which comes out to just over Mach 3. So the rounds leaving the rear of the AC would still be coming at it’s target well over mach 1.