Why are the Warriors called the dubs or Golden State is referred to as dub city?

"Dubs" is a shorter way of saying "Ws." The full pronunciation of "Ws" would be "double yooz," so it's abbreviated to "dubz" as a slangy way of referring to the team name (Warriors):

Warriors -> Ws (double yooz) -> Dubs

By the same token, "Dub City"->"W" City->Warriors City

Similarly, George W. Bush was/is sometimes referred to by the nickname "Dubya," in reference to his "W" middle name (Walker).

(One other example of a "W" name being shortened to "dub(s)": Buffalo Wild Wings is referred to as B-Dubs.)