A marine layer forms when cool air over the cold ocean is trapped under warmer air above, in what meteorologists call a temperature inversion. The air near the water gets humid, and when it cools enough, clouds or fog form inside it.
California gets it because cold water, kept cool by the California Current and by upwelling, sits beside warmer land. Carmel’s summers are cool and its mornings are often overcast with marine layer clouds that can bring drizzle, usually clearing to sun in the afternoon.
Sun heating the land can burn it off, as can strong winds. When it is deep, the clouds can last all day, giving rise to terms like May Gray and June Gloom.