Well, I just don't understand why the gun is so long???
As a general rule - Because the 155mm gun requires more propellant than the 130mm gun to fire the larger and heavier shell. This requires a longer gun barrel in order to permit the larger quantity of the propellent to be combusted completely inside the barrel as the shell is propelled through the barrel tube, while also ensuring that the required muzzle velocity and accuracy are met.
Besides, a railgun barrel is much thicker and bulkier than what is photographed on that step-deck trailer, such as this experimental one on the Haiyangshan LST:
Is the deck enough long to contain it? It's very inconvenient to put it on deck.
Yes. With proper designs that allocate sufficient spaces for the gun to rotate around, I don't see why that's difficult or inconvenient to install and operate.
In fact, here's the 155mm MONARC gun turret (which is taken from the PzH 2000 self-propelled howitzer) looks like while being installed on the Sachsen-class Hamburg for trials in the early-2000s. The Sachsen FFGs have a pretty close beam width as the 052D/DG DDGs while being 14-16 meters shorter.
If anything - The length of the barrel would be the among the least of the concerns, given that the gun turret are always mounted fore of the forward VLS cell groups on DDGs and FFGs, meaning that the gun will have a wide-enough arc of fire while also staying clear of the ship's superstructure to the aft.