Pirates had smaller, quicker vessels, in order to avoid combat when it wasn't needed, or when they were in an inferior position.
Pirates also had smaller vessels as only governments could pay the upkeep of larger ships and
because smaller, quicker ships could outmaneuver larger ships in battle. They were known for attacking huge treasure galleons packing 60 to 80 guns with their much smaller ships which only had 20 to 40 guns. Pirates also frequently razéed the ships-of-the-line they captured, which means removing decks/superstructures and guns to improve the speed and handling of the ship and turning it into a frigate.
Larger ships were meant for line battle and were ill-suited to duel with sloops and frigates. Government ships could also have demoralized and poorly trained crews, because many were press-ganged to the navy involuntarily and they were ill-treated and poorly paid. Pirates had more incentives, time and resources to practice gunnery and melee fighting and they could expect proper payment if they managed to capture a ship.
Also, I think that Red Rackham was actually a privateer (buccaneer), not a straight-forward pirate. So, he might have been contracted to attack enemy shipping (presumably by the English Crown in the original book) and could gain additional prize for capturing French warships (again, in the original book La Licorne
is a French ship).
On the other hand, Hergé's La Licorne
was said to have been based on a second-rate ship-of-the-line called Brillant
(built 1690) which had 60-66 guns and a complement of nearly 400 men. So, I do admit that Red Rackham might have been a bit foolhardy after all! Galleons, while they were big and had lots of guns, were mostly trade/general use vessels and they were very slow and cumbersome. Ships-of-the-line, especially the large first- and second-rates, were better suited for battle and had more professional soldiers on board.