Argentina, Australia, Brazil, Canada, China, France, Germany, India, Indonesia, Italy, Japan, Mexico, Russian Federation, Saudi Arabia, South Africa, South Korea, Turkey, United Kingdom, United States, and the European Union belong to the G-20, but they aren't the 20 most important economies (some of them are, but others don't fit in the top 20). What are the criteria for belonging to the G20? Is it defined somewhere? or is it something vague?
The G20 is just a group of nations that accounted for a vast majority of the worlds GDP when countries decided an international forum ought to be created to promote international financial stability, it's not necessarily comprised of the "top 20" of anything. (wikipedia)
It comes from the same vein as other forums of multiple nations such as BRICS (a group of emerging economies), G8 (A group of industrialized democracies, now the G7 after Russia was suspended for annexing Crimea) or other collaborative forums that work together but are ultimately non-binding in their decisions.
Being invited to it (by G7/G8 countries) is the main criteria. And they actually represent the biggest economies in the world, with only a few minor, readily explainable exceptions.
First, Spain or the Netherlands are not full participants because the whole thing is already very Euro-centric (and they are also represented through the European Union although that obviously also applies for Germany, France, Italy, and the UK). The G20 was created to have some forum with a broader base than the mostly European/North American mature economies of the G7/G8, so having additional European countries does not help with that. Similarly, Switzerland is a small European country and it is probably quite reluctant towards this kind of international engagement anyway.
Consequently, Argentina gets bumped into 18th position and makes the cut. I guess you could argue you could do without Argentina too but at least it's one more country from outside Europe and Latin/South America as a whole is big enough to deserve three seats at the table. There is also a very good reason to stop there instead of having a G25 or something as going further down the list only gets you more midsize European countries and a headache with Taiwan.
The rest are in fact among the top 20 economies in terms of overall GDP. The only one that's really out of place in raw economical terms is South Africa but it is in based on the need to have one representative from Africa (South Africa increasingly plays this role in many international gatherings, including the BRICS and tries to push it everywhere it can). Number 20 is the EU.