There is no hiking in Casco Viejo. You cannot go camping in Casco Viejo, either. There is hiking and camping around Casco Viejo but not inside of it since Casco Viejo is the old city of Panama. Government offices and the presidential palace is also located in Casco Viejo.
The closest you can go for hiking is Cerro Ancon, which is around 5 minutes away by car. Cerro Ancon is a national landmark so it is very popular for tourists and local Panamanians, too. Local Panamanians always take their families to Cerro Ancon. Any Panamanian family would always have a classic family photo taken at Cerro Ancon. In my case though, my family went to Cerro Ancon when I was still too little so my parents took my two older siblings and left me behind.
You can also go to Parque Natural Metropolitano, which is in the center of Panama City or to Parque Soberania for hiking. In Parque Natural Metropolitano, you can pay and entrance fee of US $5 and you can already go on the trails or stay at the park. Since Parque Natural Metropolitano is in the center of Panama City, it provides clean air to the city. It produces oxygen because of the plants. If you are in Panama City, it would take you about 10 minutes to get there.
Parque Soberania is a park, which is also about 45 minutes away from Casco Viejo and it is near Gamboa. Parque Soberania is very beautiful; it is one of Panama’s rainforests.
Camping is not a popular activity here in Panama but if you want to go camping, you can go to Isla Iguana in the Los Santos province, which is in near Pedasi in the Azuero Peninsula. Isla Iguana is a wildlife refuge so it is very beautiful.
You can also go to San Blas islands on the Caribbean side of the country and pay a small fee so you can camp there. San Blas is very beautiful and it has very clear waters. You can to San Blas by car, which is about a two hour drive from Casco Viejo. Then you can take a boat to go to the different islands. Some of the islands are too far that you have to go there by plane.