Contra Costa is a county in California, east of San Francisco, its name means "against the coast." What is against the coast? Facing the coast? Away from the coast? On the other side of the coast? The coast must be San Francisco's Pacific Coastline.
As a side note, non-English names of places in the United States don't always make sense in the original language. La Cañada, California, for example, might once have been a cattle trail, but today is far from such a thing.
Other times, people come up with exotic names because they sound chic. For example, Häagen Dasz (ice cream) doesn't mean anything in any language, but the originator was looking for an exotic name. It's been very successful and is now owned by Nestlé, a Swiss company that doesn't mind the linguistic anarchy as long as it sells.
According to Wikipedia, Contra Costa was named that originally because it was opposite San Francisco. This sounds plausible enough, though the article is light on citations, so you might want to take that with a grain of salt.
Not really. San Francisco faces the Pacific Ocean on its western edge and is situated on a peninsula that narrows down to the point where the Golden Gate bridge crosses over to Sausilito. The peninsula's east side is bordered by the San Francisco Bay. Across the bay is the "opposite coast", I suppose, not really a coast at all but the other side of the bay. You'll find Contra Costa County on this eastern side of the bay.
I'm not sure this link will work, but here's a map fr
om Google showing San Francisco in the lower left-hand corner and Richmond, California in the upper right-hand corner:
The map is actually centered on Berkeley so that you can see the other two cities. You'll have to zoom out a little to see the bay and the cities of San Francisco and Richmond. Press the minus sign ("-") at the bottom of the scale to the left to zoom out.