Trade diversion is the term given to the negative trade implications that occur when a country joins a customs union or free trade agreement. The logic is that by joining the customs union, a country will have to import goods from a less efficient country due to the common external tariff that is imposed on goods traded outside of the union.
To explain this process let's consider a simplified example of a country joining the European Union. Before joining the union, the country could import a specific commodity from the United States at the price of PUS. This results in a large number of imports from the US (Q2 - Q1). However, after joining the union, a common external tariff is applied to any goods being imported from the United States. This forces the US supply curve up to SUS+T and the new US imported price is equal to PUS. This means now that the cheapest import option available to domestic consumers is to import the commodity from other EU countries. The price of PEU is lower than the price of importing the good from the United States under the common external tariff, but is above the actual price of the US commodity. This means joining the customs union, has diverted trade away from the US to the EU and overall trade has fallen in this particular commodity. This can be represented by a net loss in economic welfare, as shown by the orange shaded region below: