As a native San Franciscan I remember the specific Woolworth's on Market Street that Don is talking about and the Emporium across the street that someone else mentioned. I don't remember trains at Woolworth's but I do remember the lunch counter. I wouldn't be able to answer why but I was fascinated by the cups they served orange juice in - they were the conical white paper cups that fit into a silver (chrome) holder shaped somewhat like an hour glass. I remember always wanting one of those the few times we ate at the lunch counter and Mom denying it because orange juice was too expensive. I also remember that the turntable for the cable car was right outside the store.
The big deal with the Emporium was their animated store windows and rooftop rides (small roller coaster, Ferris wheel, etc) at Christmas. My family bought clothes, furniture, even bicycles there.
We rode the streetcar (light rail) from our home in the Castro/Market to get to Downtown. We'd board at the exit from the Twin Peaks Tunnel and get off at the Powell Street stop.
I'm hoping Don, or one of the other former San Franciscans, can help me with this - I also remember a town train store that featured Lionel. It was a brown brick front on the store with a narrow street front but it went deep into the block. It was on Market Street and only a couple/few blocks east of Castro. This would've been back in the 60s and 70s. I used to go there to get parts and supplies for the old postwar Lionel I had at the time. It's not there any more and I can't find anything that looks like it when I search on Google satellite.