The archipelago was once the separate state of Zanzibar , which united with Tanganyika to form Tanzania ( derived from the two names ) . Zanzibar is a semi-autonomous within the union , with its own government . This United Republic of Tanganyika and Zanzibar was soon renamed ( as a portmanteau ) the United Republic of Tanzania , of which Zanzibar remains a semi-autonomous region .