It's about a 30 min. ride from LAX to the Carnival Terminal by the Queen Mary. You can use taxi, shuttle service like Super Shuttle or Prime Time, or purchase a transfer through Carnival.
Couldn't speculate on the cost since I haven't had to hire transportation--I live right near Long Beach--but Super Shuttle would probably be your best bet; cabs are pretty expensive here.
Outside of bagage claim you will find an area for Super Shuttle, etc. Just tell the attendant that you want to go to San Pedro (or Long Beach for Carnival) and they will put you in a van going in that direction. At the end of your cruise, shuttles will be available to take you back to the airport. It seems to me the price two years ago was $10 per person each way.