Tanzania is one of very few countries where Christians and Muslims are close to numerically balanced, and the balance is geographical before it is demographic. Zanzibar and the coastal strip are overwhelmingly Muslim; the interior of the mainland is majority Christian with a substantial Muslim presence in the towns.
The coastal Islam is old. Swahili civilisation grew out of Indian Ocean trade from at least the ninth century, and the stone towns of Kilwa, Songo Mnara and the Kilwa Kisiwani mosques are its monuments, inscribed by UNESCO. This is a settled Shafii scholarly tradition with its own literature in Swahili written in Arabic script, and it is among the oldest continuous Muslim traditions in sub Saharan Africa. Zanzibar was governed from Oman for much of the nineteenth century, which added an Ibadi ruling class to a Sunni population and made the island the commercial and religious hub of the whole coast, including for the slave trade that Anglican missionaries then built the cathedral at Stone Town to commemorate the ending of.
Christianity on the mainland is a nineteenth century mission product, Catholic, Lutheran and Anglican, with Pentecostal growth since.
Indigenous practice continues among the Maasai, the Sukuma and many others, in most cases alongside a world religion rather than instead of one. One consequence has to be named without euphemism: people with albinism have been attacked and killed for body parts sought by those making charms, a documented and prosecuted crime that the government, religious leaders and Tanzanian albinism organisations have campaigned against together.