Erdogan has urged John Magufuli to take action against cleric Fethullah Gulen's network of schools across the world.
The Hizmet movement run by US-based cleric Fethullah Gulen, is linked to a network of schools across the world, including in Africa, and the Turkish president is rallying leaders on the continent to help him fight the influence of his longtime rival.
"The party that wants to overthrow me isn't only in Turkey... I am convinced that Tanzania will from now on take measures against this terrorist organisation," Erdogan said after meeting Magufuli.
It was not clear what action he had asked Tanzania to take against the schools, which are believed to be affiliated with Gulen's movement. They are extremely popular among the country's middle class and often among the best performing schools.
Turkish officials accuse Gulen of using his vast private education network to build influence and of running a "parallel state" inside Turkey.
Gulen, a former Erdogan ally, vehemently denies the allegations. A reclusive figure, he has lived in self-imposed exile in Pennsylvania since 1999.
Hizmet describes itself as promoting Islam through charity efforts and educational work in countries stretching from Turkey to Africa and Central Asia to the United States.
Erdogan, whose five-day tour will also take him to Mozambique and Madagascar, also discussed business and trade.
Magufuli said he had asked Erdogan for a loan to help build a planned railway to link Dar es Salaam with neighbouring countries including Rwanda, Uganda and Burundi.
A Turkish firm is set to win a tender to build the $7.6 billion (7.1-billion-euro) railway.
The contract had initially been awarded to a consortium of Chinese companies, which had already built five kilometres of the railway.
But it was cancelled due to irregularities in the tender process shortly after Magufuli was elected.
The tender being awarded to a non-Chinese company has cast doubts over whether China's Exim bank, which finances external development projects, will still put up the money.
Erdogan's visit also comes as Tanzania looks to new sources for budgetary support and concessional loans, after several donor countries in 2015 withdrew their support over a high-level corruption scandal.
"The government is turning to Turkey as a possible source of concessional loans and investments," the government official said.
The Tanzanian government said earlier this month it would have to turn to India and China to borrow $939-million.