San Diego to San Francisco by BusGreyhound buses run from San Diego to Los Angeles. Expect many stops along the way, each one lasting 10 minutes to an hour. The fastest time is slightly more than 11 hours and fares are somewhat less than flying.
Once you get to Los Angeles, you'll have more options, including a couple of luxury buses. They're described here.
San Diego to San Francisco by TrainThe Amtrak Pacific Surfliner goes from San Diego's Santa Fe Depot through Los Angeles and north, but not quite all the way into the city of San Francisco. Instead, the trains go to Oakland, which is across the bay from San Francisco. If you choose this route, Amtrak will take you from Oakland to San Francisco in a bus. A more convenient option might be to get off Amtrak at the downtown San Jose station, where you can catch CalTrain which goes directly to San Francisco.
It takes slightly more than 12 hours by train to get from San Diego to San Francisco and it costs about the same as a bus.