Portobelo is a very small town and entirely walkable. The three main forts, the church, the waterfront, and the handful of restaurants are all within fifteen minutes on foot of each other. No transport is needed within the town itself.
To reach Portobelo from elsewhere, the most common approach is a bus or taxi from Colón, about 35 km to the west. Buses run regularly and are cheap; the journey takes roughly an hour on the coast road. From Panama City you can travel to Colón first (about an hour by bus or train) and connect from there, or take a direct taxi or private transfer, which takes about two and a half hours in total.
To visit Fuerte San Fernando, on the opposite shore of the bay, you need a short boat crossing — a few minutes each way. Local boatmen at the waterfront will take you across for a small negotiated fee.
There is no car needed in Portobelo, and no reason to rent one unless you are continuing along the coast to Nombre de Dios or further east.