The bill signed into law by Governor Jerry Brown would allow students to be treated as their chosen gender rather than that listed on their official documents.
Supporters of the law say it will help reduce bullying, while opponents have warned that the new policy will disrupt learning.
"Will transgender students make some other children uncomfortable? Perhaps," said the author of the bill, Democratic state legislator Tom Ammiano.
"I don't want to minimize that, but new experiences are often uncomfortable. That can't be an excuse for prejudice."
The California Catholic Conference objected to the law, which it said was "proposed to help just a few students, (but) will actually impact all students."
"Inevitably, some mischievous or malicious individuals will use this sweeping policy change as an opportunity to disrupt school settings for the purpose of intimidating others, exactly the behavior we wish to address," it said.
California, the most populous US state, has been at the forefront of a nationwide debate on gay, lesbian and transgender rights.
The US Supreme Court in June declined to reinstate the state's so-called Proposition 8 ban on same-sex marriage, allowing such unions to resume five years after a referendum initiative banned them.
US public acceptance of gay marriage has risen dramatically in recent years.