Because both are cities whose housing stock (in the trendy areas) was largely built in the 19th century (NYC) or early 20th (SF), with little to no infrastructure investment since then, so both are presumably the birthplace of the future but feel older and more rundown than even much older European cities (most of whose infrastructure was built post-war).