Flight
There is an airport in San Luis Obispo, but it may be cheaper to fly into San Jose or LAX and rent a car.
Train
If you don't want to rent a car, you can fly into either LAX or Burbank Airport (info here: https://www.pacificsurfliner.com/plan-your-trip/connections/airport-connections/?gad_source=1&gclid=CjwKCAjwx4O4BhAnEiwA42SbVNVCTqfOok8c2YeJvWkftdDoyUaKDUcoDy4aEgQzCEhudOK45D8g0xoCU8oQAvD_BwE) and then take the train up to SLO. Might be long travel day but you do get to see that Pacific Ocean!
Travel Note
If you want to rent a car and drive up to San Luis Obispo, consider taking California State Route 154 along the way. Stop off in Santa Barbara and get some of the best Mexican food out there at La Super Rica (https://www.superricataqueria.com/), then get on the 154 (aka San Marcos Pass Road or Chumash Highway) that takes you through the Los Padres National Forest into the Santa Ynez Valley and Lake Cachuma. Stop at a winery along the way (highly recommend Roblar) and take in some of the most beautiful scenery California has to offer. It's a detour, but it's worth it. And, if you drive from either San Jose or San Francisco, taking PCH will absolutely be worth it, but it will be a longer drive.