The Galaxy enters the Gatun Locks early in the morning (~6-8AM) and then anchors a mile or so away from the locks in Gatun Lake. At this time, only passengers with booked tours are allowed to leave the ship. The reason for this restriction is that the dock that the tenders use on the shore is in a remote location with no facilities (primarily a parking lot for tour buses).
Sometime later in the day, the Galaxy returns back through the Gatun Locks and then docks at Cristobal Pier. Any remaining passengers may disembark at this time to visit the fairly large shopping mall on the pier. It is too late in the day for any tour to leave from here. In addition, this is where the passengers that disembarked for a tour while in Gatun Lake return to the ship.
I highly recommend that you take a tour. If you stay on the ship, you will see Gatun Locks twice and not much else. Remember that the Panama Canal is 55 miles long and if you stay on the ship, you will see less than 5% of it and very little of the country of Panama.
We have been on two tours in Panama and can recommend either: "The Ocean-to-Ocean Train Tour," and the "Grand Tour of Panama." Of these two, the Train Tour is my primary recommendation, and is in fact my favorite tour of my 12 cruises. This tour is about 5 hours and is about 1/2 train time and 1/2 bus tour time at the Pacific end of the Canal (you will see the Bridge of the Americas, Mira Flores Locks, and several ex-American Military Bases, and the Canal Headquarters).
The "Grand Tour of Panama," contrary to what the name implies, is a much shorter tour, but interesting. It visits Gatun Locks (from the landside) and later visits an Indian Village. Interesting experience, but you will see more of Panama on the Train Tour.