Because Panama was once a colony of Spain.Panama was part of the Spanish empire for several centuries. The language of that empire was Spanish. When Colombia became independent of Spain, it kept the Spanish language and when Panama became independent of Colombia, it also kept the Spanish language.
There is not one official language spoken by the world.
The official language spoken in England is English.
The official language spoken in the Netherlands is Dutch.
The official language spoken in Montserrat is English.
The official language spoken in Bratislava, Slovakia is Slovak.
The official language spoken in Romania is Romanian.
The official language spoken in Georgia is Georgian.
The official language spoken in Norway is Norwegian.
The de facto official language spoken on Christmas Island is English.
The official language spoken in Montserrat is English.
There is only one country in Central America that has English as an official language, and that is Belize. There are two other countries that recognize English as a language, although Spanish is the official language and they are Honduras and Nicaragua.