The branch that punishes pirates is the judicial branch. It is responsible for interpreting laws and administering justice, including punishing those who violate laws such as piracy.
More specifically, under United States law, Congress has the power to define and punish piracies (Art I, Section 8 of the U.S. Constitution), and piracy laws are enforced through the judicial process based on federal statutes. Internationally, piracy is treated as a crime under international law, and states have the jurisdiction to seize pirate ships and prosecute pirates in their national courts, which again falls under the judicial authority.
Thus, the judicial branch punishes pirates by prosecuting them under applicable laws both domestically and internationally.