To echo The Dark, as long as men have been able to gather together and set to sea, there’s been piracy in the Mediterranean.
Some of the earliest examples of galleys (not long after the ancient Egyptians) were designed for a group of oarsman-marines to be able to get to another ship fast, empty the benches, picking up weapons and shields as they went, then board. The dreaded Sea People who are written about in the time of the so-called Bronze Age collapse were often drawn travelling in pentekonter-style galleys, one bank of 25 oars on each side, totalling 50-odd men who would both row and fight.
It was only with the later, bigger galleys that there tended to be a specialisation of labour with lots of oarsmen and only a handful of marines. What this did was make ships much faster and more enduring under oars. Contrary to Hollywood myth, most oarsmen were not slaves (where do you keep them at night?), but professionals or mercenaries. In the sole case of Athens, they were citizens performing military service to their city.
Worth noting that generally an oared ship, particularly over a sprinting distance, is faster and more maneuverable than a sailing ship. Especially before the invention of the lateen sail.
The aforementioned Aetolians and Arcanarnians were notorious pirates, but any vessel in the water might turn it’s hand to a little opportunistic piracy if presented with the chance. The Phoenicians, acknowledged as master sailors, weren’t averse to doing so either.
It’s worth remembering that captives taken during pirate raids was one of the major sources of slaves for the slave markets in antiquity. Moreso than defeated warriors taken in warfare or cities having all their inhabitants sold to pay debts, until the late Hellenistic/early Roman era.
In a fight, the mast and sail would be taken down, to avoid it being damaged, and reduce the risk of fire. Firepots being one of the weapons that might be deployed in a ship fight.
As has been said, until late into the Hellenistic era, and even then, artillery wasn’t an important fighting tactic. Ramming and boarding, with the added tactic (mastered by the Rhodians) of shearing. Shearing is where instead of aiming your ram at the enemy ship, you aim at his oars. If he doesn’t get them in fast enough (which is a standard procedure when an enemy closes), he risks having oarsmen killed and maimed by broken oars lashing about inside the rowing deck(s).
Something else that isn’t shared by the Age of Sail: Mediterranean galleys were not totally waterproof, and took on water to become watertight. However, the longer they were in the water, the more waterlogged their boards got, making them heavier, thus slower and less maneuverable. To counter this, at night they were pulled up out of the water to dry out if possible. They weren’t left moored in the water at docks. Because of their shallow draft and light construction, any beach would generally do. Rocky shores would actually be of no use whatsoever, since they’d inhibit your ability to get the ship out of the water.
Ships didn’t stay at sea for days on end, or usually cross the open sea either. Most coasted, staying not far from land. Not just because many cultures didn’t have the navigation skills to chart a course by the stars (though the Phoenicians did), but also because you couldn’t carry enough water and food for several hundred oarsmen for more than a day or two.