December 9th, 1961.
The mainland of Tanzania became a German colony called Tanganyika in 1884 whilst the Sultanate of Zanzibar became a British Protectorate in 1890. Tanganyika became a British mandated territory in 1918 and achieved independence in 1961.
In 1963 Zanzibar achieved independence, and a year later formed a union with Tanganyika under the new name of Tanzania.
In 1954, Julius Nyerere, a school teacher who was then one of only two Tanganyikans educated to university level, organized a political party—the Tanganyika African National Union (TANU). On December 9, 1961, Tanganika became an autonomous Commonwealth realm, and Nyerere became Prime Minister, under a new constitution. On December 9, 1962, a republican constitution was implemented with Mwalimu Julius Kambarage Nyerere as Tanganyika’s first president.
Zanzibar received its independence from the United Kingdom on December 10, 1963, as a constitutional monarchy under the Sultan. On January 12, 1964, the African majority revolted against the sultan and a new government was formed with the ASP leader, Abeid Karume, as President of Zanzibar and Chairman of the Revolutionary Council.
In the first few days, between 5,000 and 15,000 Arabs and Asians were murdered, women were raped and their homes burned. Within a few weeks, a fifth of the population had died or fled.
It was at this time that the Tanganyika army revolted and Britain was asked by Julius Nyerere to send in troops. Royal Marines Commandos were sent by air from England via Nairobi and 40 Commando came ashore from the aircraft carrier HMS Bulwark. Several months were spent with Commandos touring the country disarming military outposts. When the successful operation ended, the Royal Marines left to be replaced by Canadian troops.
On April 26, 1964, Tanganyika united with Zanzibar to form the United Republic of Tanganyika and Zanzibar. The country was renamed the United Republic of Tanzania on October 29 of that year. The name Tanzania is a portmanteau of Tanganyika and Zanzibar and previously had no significance. Under the terms of this union, the Zanzibar Government retains considerable local autonomy.
(sources: 1; 2)