If you are a national of a country which requires a visa to enter or remain in the UK, you will need to apply before you travel by completing the online application form.
To find if you are a Visa National, please visit the following UK Government website:
Visa nationals country list
You must apply for and receive a short term student visa before you travel to the UK.
If you are a non-visa national intending to study for up to six months, then you can apply at the port of entry providing you have arrived from outside of the UK/ Republic of Ireland.
However, if you intend to study an English Language course for up to 11 months on a Student visitor visa, then you will need to apply before you travel, even if you are a non-visa national.
For more information please visit this page:
Short-term Study Visa