You apply in person at your local Immigration Office where your TM30 is filed. Go there well in advance and get their list of requirements for the Visa you will be applying for except if it is a Non-B or a Non-ED which requires you to get everything from your employer or school and they will tell you if it can be dne in country or if you have to leave and apply outside.
People, like myself, have had bank accounts for years when it was easy to do so on Visa Exempt stramps especially in tourist areas. Arrive with the correct Visa (not a tourism entry stamp) it is still possible, just get a residence certificate from Immigration.