This concept was introduced by British politician David Ricardo in the 1800s. According to him, even if one country is better than another in producing all goods, it still stands to benefit from specializing in certain fields and trading it. This is because the opportunity cost of producing different goods varies between countries, and specializing in the production of goods with lower opportunity costs allows for more efficient use of resources.
Source: Investopedia