It is my understanding that in certain political climates it is sometimes easier
to procure funding for a “fighter” aircraft than a “bomber” aircraft.
While early models of the F-111 indeed had a gun, it was ultimately
removed to accommodate targeting hardware eg F-111A-F-111F.
NavAir had a much better scheme for designating aircraft that told the initiated almost everything they needed to know about the airframe in question. Naturally it was discontinued after two congress-critters were
arguing about the F-110 and the F4H fighter jet….which of course turned out to be the same aircraft more or less.