Is it legal to rent my detached garage (and not the house) to a private party for storage use only? Or is this a violation of CA rental code?
There is no such thing as the CA "Rental Code." The laws governing rentals are mostly in the Civil Code, but many are elsewhere. To answer your question, though, there is no state-wide prohibition on renting a garage as storage space. In fact as long as you make it clear in a written lease that you are renting storage space and not "residential" premises, you're pretty much on the same legal footing as a commercial business renting warehouse space or something like that. Off the top of my head, the only law I can think of you might be violating would be local zoning ordinances. Some cities have restrictions or prohibitions on home based businesses, which a city could say renting garage space is. On the other hand, if the tenant is only using it for long term storage, and not coming and going to put in and take out items frequently, it is unlikely that any enforcement action would be taken even IF it were a technical violation.
I am a lawyer in CT and practice in this area of the law. As long as your tenant is placing the item in the garage and the garage can close so no one really knows what is being stored you should not have any issues with renting the garage. as a precautionary measure, i suggest that you execute a written lease and take a security deposit. If you need help drafting the lease, I suggest that you hire a lawyer to help you.