Price Wars
Take two firms selling the same product. If both keep their prices high, they both make good profits. But each firm can steal customers by cutting its price, and if both do that, they end up in a price war where both earn less. This is also why cartels like OPEC have a hard time sticking to their limits, since every member is tempted to produce a bit more than its quota.
Example profits for two competing firms, in millions of dollars.
Arms Races
During the Cold War, the US and the Soviet Union were in a similar spot. Both countries would have been better off spending less on weapons, but neither wanted to cut back while the other kept building. So both kept spending, which is the same outcome as both prisoners confessing.
Advertising
Advertising can work the same way. If two rival companies both advertise heavily, a lot of that spending just cancels out. A well known example is the 1971 ban on cigarette ads on US TV and radio, which some economists argue actually helped the tobacco companies, because it made all of them stop spending on those ads at the same time.