Can anyone become an astronaut?
There are two types of organization that have jobs for astronauts: Government agencies (e.g. NASA) and private space companies (e.g. Boeing).
Government agencies tend to accept only citizens of their own country. For example, NASA takes only US citizens, ESA takes only citizens of member countries.
NASA does have an International Internship Programme which anyone can apply for. It is "designed so interns can enhance their international and inter-cultural understanding by working on NASA research or a NASA-related mission or project". For details see intern.nasa.gov.
The situation with private companies is a little easier, in that you may be able to apply even if you're from a different country. You'll need to see each company's website for more information.