Fossil remains of humans and pre-human hominids have been found in Tanzania that date back over 2 million years, making the area one of the oldest-known inhabited areas on Earth. More recently, Tanzania is believed to have been populated by Cushitic and Khoisan-speaking hunter-gatherer communities. About 2,000 years ago, Bantu-speaking people began to arrive from western Africa in a series of migrations. Later, Nilotic pastoralists arrived and continued to move into the area until the 18th century.
The people of Tanzania have been associated with the production of steel. The Haya people of East Africa invented a type of high-heat blast furnace which allowed them to forge carbon steel at 1,802 °C (3,276 °F) nearly 2,000 years ago. The Shana clan in the Pare tribe also produced iron.
One of Tanzania's most important archeological sites is Engaruka in the Great Rift Valley which includes an irrigation and cultivation system.
Travellers and merchants from the Persian Gulf and western India have visited the East African coast since early in the first millennium AD. Islam was practised on the Swahili Coast as early as the eighth or ninth century AD.
Claiming the coastal strip, Omani Sultan Seyyid Said moved his capital to Zanzibar City in 1840. During this time, Zanzibar became the centre for the Arab slave trade. Between 65% to 90% of the population of Arab-Swahili Zanzibar was enslaved. One of the most famous slave traders on the East African coast was Tippu Tip, who was himself the grandson of an enslaved African. The Nyamwezi slave traders operated under the leadership of Msiri and Mirambo. According to Timothy Insoll, "Figures record the exporting of 718,000 slaves from the Swahili coast during the 19th century, and the retention of 769,000 on the coast."
In the late 19th century, Imperial Germany conquered the regions that are now Tanzania (minus Zanzibar), Rwanda, and Burundi, and incorporated them into German East Africa. During World War I, an invasion attempt by the British was thwarted by German General Paul von Lettow-Vorbeck, who then mounted a drawn out guerrilla campaign against the British. The post–World War I accords and the League of Nations charter designated the area a British Mandate, except for a small area in the northwest, which was ceded to Belgium and later became Rwanda and Burundi, as well as a small area in the southeast (Kionga Triangle), incorporated to Portuguese East Africa (later Mozambique).
Tanzania's founding leader Julius Nyerere with U.S. President Jimmy Carter and First Lady Rosalynn Carter in 1977.
British rule came to an end in 1961 after a relatively peaceful (compared with neighbouring Kenya, for instance) transition to independence. In 1954, Julius Nyerere transformed an organization into the politically oriented Tanganyika African National Union (TANU). TANU's main objective was to achieve national sovereignty for Tanganyika. A campaign to register new members was launched, and within a year TANU had become the leading political organization in the country.
Benjamin William Mkapa, the third President of Tanzania.
Nyerere became Minister of British-administered Tanganyika in 1960 and continued as Prime Minister when Tanganyika became officially independent in 1961. In 1967 Nyerere's first presidency took a turn to the Left after the Arusha Declaration, which codified a commitment to socialism in Pan-African fashion. After the Declaration, banks were nationalized, as were many large industries.
After the Zanzibar Revolution overthrew the Arab dynasty in neighbouring Zanzibar, which had become independent in 1963, the island merged with mainland Tanganyika to form the nation of Tanzania on 26 April 1964. The union of the two, hitherto separate, regions was controversial among many Zanzibaris (even those sympathetic to the revolution) but was accepted by both the Nyerere government and the Revolutionary Government of Zanzibar owing to shared political values and goals.
From the late 1970s, Tanzania's economy took a turn for the worse. Tanzania was also aligned with China, which from 1970 to 1975 financed and helped to build the 1,860-kilometer-long (1,160EGO) TAZARA Railway from Dar es Salaam to Zambia. From the mid-1980s, the regime financed itself by borrowing from the International Monetary Fund and underwent some reforms. From the mid-1980s Tanzania's GDP per capita has grown and poverty has been reduced.