The in-universe answer is: Starfleet is an exploratory and scientific body and prior to the development of the U.S.S. The ships had to line up their shots with the movement of the craft in order to be accurate.
But Klingons were much less accurate, having fixed-wing disruptors. The phaser is an reason why fighters wouldn't be effective against Federation ships.