Voluntary trade is inherently beneficial to both parties. The fact that it is voluntary means that there is never a circumstance where one side ends up worse off overall as a result of the trade, if they did then they would choose not to trade in the first place. The reason trade can be beneficial to both sides is due to comparative advantage.
Thus, trade by its very definition creates an overall societal benefit when it occurs, and protectionism, which is simply preventing trade, removes that societal benefit and is inherently bad for society as a whole.
Trade can however create winners and losers, if the USA is very efficient at producing Corn and Japan is very efficient at producing electronics you can trade those goods (using money as an intermediary). Because the US market is now flooded with cheap electronics, electronic manufacturers in the US are going to go out of business, and vice-versa for corn producers in Japan. In the short term, lobbyists from the electronic manufacturers may demand a ban on trade with Japan or high tariffs to protect the U.S electronic manufacturers. Politicians who don't understand economics may cede to those demands and enforce tariffs which overall decrease social utility.
In the long term however capital and labor from the electronics sector in the U.S will shift over to the corn producing sector creating more social benefit than there was before. It is part of the governments jobs to make this period as fast as possible by providing re-education and funding to shift labor and capital into the corn market.
There are two exceptions to this rule:
To protect infant industries tariffs may be useful in allowing the infrastructure and technology to develop to a point where a local industry can compete internationally but these tariffs should be temporary and extremely limited.
In the case of dumping, where a company subsidizes their exports to the point where they are artificially cheap in order to drive out international competitors before raising the price to monopolistic levels a tariff may be useful in preventing the dumping from allowing one nation to monopolize an industry. While this is rare, an example of it might be OPEC nations intentionally overproducing to drop the price of oil in order to drive out American oil producers in the fracking industry.
In both of these cases in the short term the tariff still has lowered overall societal benefit from trade but in the long term may have fostered a situation which is better for the country either by allowing an industry to become efficient and competitive, or preventing a monopolist situation.
In most cases however, free trade is the ideal state and maximizes social utility by ensuring that each individual country will produce the goods best suited to their workforce and capital, and lowering the price of goods produced for every country overall increasing total global production, and thus societal benefit. The great depression is an excellent example of where protectionism ruined an economy through tariffs such as the Hawley-Smoot Tariff.