The first Chinese to arrive in San Francisco were brought to the city around 1845 under contract by Americans. In 1849 the Chinese immigrants conducted their first organizational meeting at the Canton Restaurant in San Francisco. During the 1850s, the number of Chinese in California increased greatly due to the Gold Rush and the hope for plentiful employment opportunities created by such endeavors as the transcontinental railroad.

The early Chinese stores in San Francisco were along Sacramento Street, which was called "Tong Yan Gai" or Chinese Street. Chinese businesses also occupied the buildings on Dupont (now Grant) between Sacramento and Jackson, and Jackson between Kearny and Stockton. In 1854, the first Chinese newspaper was published, exemplifying the bustling commercial community in the area now called Chinatown.

San Franciscans at first regarded the hard working Chinese with favor, although they were segregated from the other parts of the city. However, with the completion of the railroad, many Chinese drifted to San Francisco. They offered a cheap supply of labor and the public opinion began to change radically from acceptance to racial hatred.

The language problem and discrimination against them forced the Chinese to band together. Chinatown developed its own organizational network based on traditional Cantonese structures to provide for the needs of its people. The most visible and important of these was the Chinese Six Companies, an organization of members from six districts of China. The organization, formed around 1862, administered justice and undertook many community functions such as founding language schools and Chinese temples. Christian churches, begun in the early 1850s, also developed social welfare agencies to aid in community problems.

The 1870s-1890s were an intense period of anti-Chinese sentiment and violence throughout the country. The anti-Chinese agitation drove Chinese from many settlements in rural California to San Francisco, creating crowded conditions and more problems. Crowds of discharged white laborers began to persecute the Chinese, who were taking their places in the CIty's labor force. On July 24, 1877, several hundred men rampaged the City, attacking any Chinese in sight.

Legislation discriminating against the Chinese began emerging during this time. Much of it was ruled unconstitutional by the state and federal Supreme Courts. The culmination was the Chinese Exclusion Act of 1882, which suspended the immigration of Chinese laborers into the United States and prohibited naturalization. The time between 1890 and 1900 saw a decline in the Chinese population because of this.

The 1906 earthquake and fire destroyed all of Chinatown, but the Chinese returned to the area and rebuilt. The fire destroyed all the records and allowed thousands of Chinese men to become "paper citizens" by signing certificates which gave the United States as their place of birth.

The post-Depression period brought great change to Chinatown. Restaurants and shops with neon signs began to appear, attracting tourists who viewed Chinatown as novel. Instead of an area concerned with the needs of people living within it, Chinatown became a tourist center concerned with the tastes of people living outside it.

In 1947, the restrictive housing covenant which had prohibited the Chinese from buying homes outside of Chinatown was lifted. The 1950s saw the wane of Chinatown as families took advantage of the post-war boom and moved into North Beach and the Sunset and Richmond. The old-timers and the tourists remained. In 1951, the Ping Yuen housing project for Chinese was started.

The decline in the Chinatown population halted during the 1960s when all laws limiting immigration on the basis of race or nationality were eliminated. This reinvigorated Chinatown as a place of business, residence, and community. However, the social fabric of the area had changed. Most white collar families left Chinatown for other parts of the city, but it continues to have the highest density of any neighborhood in the city.