Dude was originally a term employed by rural folks to refer to city slickers. A "dude ranch" is a working ranch that caters to city residents and trots them around on horses for high prices. At some point, surfers started calling each other dude, and some time afterward, all of California. More or less.