Capitalism is the main creator of wealth for a society, from which to distribute and share the wealth. Albeit, we believe that capitalism needs sufficient rules and rule-enforcement.
The reason our capitalistic countries are wealthy is because of "economies of scale" or specialization.
At one time, every human had to do everything: farm pigs and chicken, build the home, make clothes, cook, etc. Then humans found out that they could get ahead by specializing. If one family farmed only pigs and another farmed only chickens and then the first family traded some of their pigs for some of the second family's chickens, both families ended with more pigs and chickens. As an example, both family A and family A used to produce 10 pigs and 10 chickens each. After they specialized, family A produced 30 pigs and family B produced 30 chickens. After they traded with each other, they ended up with 15 pigs and 15 chickens each.
They took this one step further. At one time, one member of each family sewed all of the clothes. As an example, one person from each produced 1 shirt per month, producing a total of 10 shirts per month for a 10 family society. Each person had to know how to sew collars, sleeves and buttons. Then they came up with an idea to convert a barn into a factory where they will have multiple sewing machines, powered by one pulley system. Each person operated one of the sewing machines, but each of them specialized in only one function: sewing collars, sleeves or buttons, not two or three. To build this factory, it needed more money than any of the families had alone. Therefore, each family invested in the factory and owned a share of this new company, hence the birth of the corporation. They found that the factory produced 20 shirts per month with the same number of people who were producing 10 shirts per month before. Not only did the society end up with more shirts, but because higher volume drives down price, the shirts were less expensive. Hence, this specialization and economies of scale made this society wealthier.
Then humans took this many steps further. Some families specialized in only building homes. Others specialized in only farming and others specialized in only cooking. From these economies of scale, humans became wealthier and wealthier.
Some of the wealthiest individuals are ones that specialize in only one thing, such as throwing a baseball over a diamond, investing in stocks or acting in movies. These people don't have to know how to grow food, build homes, cook or make clothes. The more a society specializes, the wealthier the society will be.
Economies of scale is the fundamental reason behind trade for two individuals, or for two countries. Let's say there are two countries that both produced sugar and wheat. If they specialized and traded, both of them will become wealthier. To explain this example, let's say each country produced 10 units of sugar and 10 units of wheat, for a combined total of 20 units of sugar and 20 units of wheat. If country A produced only sugar and country B produced only wheat, then country A will produce 30 units of sugar and country B will produce 30 units of wheat. Then they could trade 15 units of sugar for 15 units of wheat, which means they would end up with 15 units of sugar and 15 units of wheat each. They would be 5 units richer in sugar and wheat.
This is the main reason for having freer trade between countries. Some people will argue that workers in each country will lose jobs, or that they will have to do a different job. This is correct. This is the short term pain that a country must decide if it is willing to endure in order to get long term gain. Job loss and job changes have occurred in human history for the past two thousand years. At one time, most humans were hunters or farmers. The vast majority of humans have changed jobs, multiple times, since then.