Thailand is well known for its tourism industry, and to boost this sector of economy the Thai government has many bilateral agreements in place with a large number of countries to allow their citizens to visit Thailand. These tourists can come on the Thailand visa-free scheme for a different period of time depending on their individual country’s agreement, either 14 days, 30 days, or 90 days.
Before covid-19 border closures, people from more than 60 countries could enjoy visiting Thailand as a tourist without applying for visa in advance. They could get a tourist visa on arrival at any international airport in the country, and at land border checkpoints. Some land border checkpoints charge a small fee, and for arrival by ship to any seaport, a fee may be applied as well. The list of countries where citizens can enjoy this visa-free scheme can be seen on websites relating to Thailand tourism including this one.
If not coming to Thailand as a tourist, even with the visa-free scheme, persons must apply in advance for their specific type of Thai visa. In addition to this, some nationals, even coming to Thailand as a tourist, will still need to arrange a visa in advance. This includes most countries in Africa except South Africa, many Middle Eastern countries except UAE, Oman, and Saudi Arabia. Some countries in Central and South America also need to arrange a visa in advance to visit Thailand as a tourist; except Brazilians, Peruvians, Argentinians, and Chileans who can come here under the visa-free scheme. Some European nationals also need a visa, i.e., citizens of Belarus and former Yugoslav republics except Slovenia. For further information you can check from relevant Thai government websites or this easy-to-understand informative Wikipedia page.
At present, with the widespread craziness going on in the world, the visa policies for many countries around the world have changed. Many citizens that used to come to Thailand with visa-free scheme or visa on arrival may have to apply for visa and/or submit documents related to covid and health tests, and possibly other relevant documents. For up-to-date information, you can check from official websites including these: COVID-19 Guide for Travelers to and in Thailand and How to Travel to Thailand in 2021.