I have done both, both are very exciting and amazing in their own ways.
Our boat was in San Francisco for several years (in three different marinas) and we spent more than a month in Monterey Bay (Moss Landing). As I said, both have their charms. San Francisco is very active and a lot of sightseeing. Winds can hit 30-35 kts easily every summer afternoon,
current regularly hitting 5+ knots under the Golden Gate, a lot of
shipping traffic, several nice restaurants with public docs, gorgeous views of San Francisco at night (or sometimes under fog), nice
anchorages etc. Sailing can be pretty rough but it is not ocean sailing, no swells, and feeling is different. You can also sail up to Drake's Bay and down to Half Moon Bay to get a bit of ocean feeling as well. But there is so much in San Francisco Bay (if you also include San Pablo Bay,
delta, etc), you can easily spend a year+ exploring it.
Monterey Bay is a different beast, a couple of potential destinations (Santa Cruz, Capitola, Moss Landing, Monterey) but not that many. It is ocean sailing and amazing biodiversity (a whale broached at 50 yards from us, amazing but equally scary), pods of
dolphins, orcas, sharks etc. It is amazing but lack of variety in
anchorages and destinations became a bit boring for us after a month.
I'd say explore both. I'd spend some time in Monterey Bay and then go up to San Francisco Bay and explore it. Both are beautiful.