Capitalism is an economic system that uses a high degree of capital (or productive) assets, has a high degree of division of labour, and requires a medium of exchange. Capitalism started with what is called the industrial revolution and got a big boost with American independence and the spread of a greater amount of freedom and property right. Capitalism produces a myriad of products and services that sustain higher populations and reduce poverty. (Unfortunately, the term capitalism is misused to refer to political systems that grant privileges to large companies in violation of free enterprise and property rights.)
Subsistence agricultural and cottage industry is another type of economy that uses some capital assets, has some division of labour, and uses a medium of exchange along with barter. A hunter and gatherer economy uses few capital assets, little division of labour, and has largely self sufficient groups which which may or may not barter or use some medium of exchange.
The three types of economies described above can all exist in the same region at the same time although if capitalism is present, it will dominant the economy.
A capitalist economy can function in any form of government, but will be most effective where there is freedom and protection of property right. Socialist, fascist, and dictatorship forms of government restrict free enterprise and property right. There is nothing stopping these forms of government from investing in productive assets, but they are subject to bureaucratic management which is less effective than private enterprise. Democracies are a mesh mash of socialism, fascism, dictatorship, and some property right all of which is subject to ineffective bureaucratic management.
The best form of government is a constitution that has laws that do no more nor less than protect the right of individuals to decide what they do with themselves and their possessions (property right) with provision to be made whole if that right is violated. All operations would be provided in the private sector where private ownership would avoid waste, the profit motive would provide low cost, efficient operations, innovation, and a high level of customer satisfaction, all in contrast to bureaucratic management. Under such a government, capitalism would flourish with peace and prosperity for all.