From someone who actually lived in SF:
I don't know why the others keep recommending Fisherman's Wharf. Don't waste your time.
Do take the trolley up there from Powell St, though (don't bother with the line at Union Square -- go up Powell, and just hop on the trolley at a stop sign. Seriously!
). But when you're at the end, instead of going to the Fisherman's Wharf, just go to Ghirardelli Square -- very touristy but pretty decent nonetheless.
If you're there on a Saturday, definitely go to the farmer's market at the Ferry Building. Go there early! (about 10 AM or 11 AM, no later). Try the lamb hot dog -- unbelievably delicious. And buy some chocolate brittles before you leave. If you're there on a Wednesday, check out the farmer's market at Civic Center -- not as clean as the Ferry Building (there's a ton of homeless people there), but grab the kettle popcorn, and if the truck hasn't left yet (go early!), grab a Belgian waffle. Both are blow-your-minds unbelievable.
While you're at the Civic Center. be brave and go north a couple of blocks to Golden Gate -- there's a burrito place between Hyde and Larkin called El Castillito. After you've eaten a burrito there, you'll never be the same. Honest.
Do check out the Castro -- a great couple of blocks to take a stroll. Stop by the Castro Coffee Company -- forget Blue Bottle, this is where you can get great coffee.
Do check out the Golden Gate Bridge. Do check out Golden Gate Park. Do check out the Seacliffs (stop by the little diner hanging right off the cliff for some excellent chili, then take a walk north on the old train tracks (the tracks themselves has long ago been removed, leaving a nice trail) along the cliff -- excellent views of the sea). Do check out Chinatown -- kitschy and touristy as hell, but great atmosphere. Go west a block to Stockton to see the *real* Chinatown.
Alcatraz? Well, why not. Worth going once.
Also check out Valencia -- great bars and nightlife there. And there's Puerto Alegre, where you can find the best steak nachos in America (IMO, at least).
Places to eat:
The previously mentioned farmer's markets.
The previously mentioned El Castillito.
The previously mentioned Puerto Alegre on Valencia. Just get the nachos, don't bother with anything else.
Stinking Rose is great, too.
While you're in Chinatown, stop by Sweetheart for some boba drinks. Best in the city.
If you like dim sum, Yank Sing has the best dim sum south of Vancouver.
If you're willing to go out of the way for the best Guinness you'd drink outside of Ireland, go to The Star and Plough, in the Richmond. Looks like crap, atmosphere is crap, but the Guinness... blows... your... mind. If you're not a Guinness megafan, ignore this one.
And for some mind-blowing dessert, go to the mall at Powell, go up to Nordstrom's, then go to the top floor, and go to the cafe there. Have some vanilla ice cream and bread pudding. Make sure to have a mop ready, you'll need to mop up your blown mind afterwards.
And lastly... make sure you make your way to Paxti's on Hayes. Forget Chicago, this is where you will discover deep dish pizza -- and I've been to Chicago.
And an obligatory nod to Mozzeria, a (fancy, or 'gourmet' if you will) pizza place owned and run by the Deaf on 16th Street.
I could go on and on, but I think that will fill up your days nicely.