A trebuchet on a ship is entirely possible. The key benefit is that since trebuchet is a counterweight engine, it can be built to be powerful without shaking the ship apart when it is fired. The downside is that since it is a counterweight engine, it introduces large moving masses to something already unstable. Trebuchets also need to be relatively large to make sense.
The most realistic use would be as a siege weapon. The ship would sail to target, anchor itself securely, remove masts and rigging, assemble the trebuchet on deck and start firing. The ammunitions and the counterweight would double as ballast. The main structure for the trebuchet would also serve as base for the main mast. If the ship only had a single mast, it would be possible to use the arm of the trebuchet as the main mast, but it is probably better not to, as the stresses are different.
The trebuchet would fire lengthwise to avoid capsizing from sifting masses, and the deck would have a lengthwise opening to make space for the arm and counterweight to swing. Basically the arm would swing down enough that loading the trebuchet from the ammunition in the ballast would be easy. The opening would be coverable for sailing. The visible difference would be that since the counterweight needs to swing freely below the point of attachment to avoid breaking the ship, the mast attachment would look unusual.
Also the ship would be rather large since building small trebuchets is not really sensible. Probably a modified merchantman. Large, slow, carries lots of ammunition, has good stability, and is easy to acquire.
A trebuchetship could actually be useful for naval engagements. Many famous naval victories were gained by tricking the enemy into waters where their maneuvers were restricted and they were unable to use their numbers. Large number of ships congested into a small area would make a pretty good target for a trebuchet. Hitting anything would be pure luck, and the rate of fire would be slow, but a ship unlucky enough to be hit by a trebuchet would notice it. But that would be incidental, the intended use would be as a mobile siege weapon for raiding fortified coastal targets.
Also floating trebuchets would be used against the seaside defenses of cities, but those would probably be rafts or barges built on site, not trebuchetships.