Could they go anywhere they wanted to find targets?
Definitely not. Boats were assigned to specific areas, both for safety and coverage. If they were outside their assigned area, they might be attacked by friendly forces who weren’t very good at distinguishing our submarines from the Japanese. Or the captain might incorrectly identify another of our submarines and attack. The boat might also miss shipping that was proceeding through its assigned area that the higher commanders assumed it would intercept.
This was likely frustrating for some captains. The most successful captains were often assigned to the most promising areas. That might mean that the less successful captains might have a difficult time finding the targets to become successful, and to then get the better assignments.