* Cedric Villani launches election run for mayor of Paris
* Macron had picked ally Benjamin Griveaux for job in July
* Villani bid shows Macron may not have learned 2017 lessons
* Elections 6 months away, Socialist incumbent could benefit
By Elizabeth Pineau and Michel Rose
PARIS, Sept 4 (Reuters) - Emmanuel Macron's bid to control Paris City Hall plunged into uncertainty on Wednesday after ruling party lawmaker Cedric Villani said he would challenge the president's own candidate - a rebellious act akin to his own rise to power in 2017.
Villani is an eccentric maths genius who entered politics in 2017 when Macron's fledgling Republique En Marche (LREM) party redrew the parliamentary landscape in France, and has become one of the most popular Macronista figures with the public.
Six months away from the March municipal elections, his move clouds Macron's prospects for conquering the French capital to build a local power base for his party and make inroads into the last bastion of the old establishment dominated by socialists or conservatives: 35,000 town halls nationwide.
Opinion polls show Villani and Benjamin Griveaux, a close Macron ally who helped propel the former investment banker to the Elysee, running neck-and-neck for the Paris mayoralty.
"Many complex problems will need to be worked out, which can be done by working together playing to our strengths," Villani told supporters. "I've been tackling complex problems my whole life before entering politics," he said, adding that he would be Paris' first "truly environmentalist mayor".
Voter surveys show Villani and Griveaux each winning 25% percent in Paris if one of them dropped out beforehand, ahead of Socialist incumbent Anne Hidalgo, but splitting 25% if they both run. The latter scenario could help Hidalgo win re-election, despite her own unpopularity due to the congested streets and polluted air of Paris. "It's all very confused but I can't say that saddens us," Hidalgo deputy Emmanuel Gregoire told Reuters.
The unprecedented challenge to Macron's political decision-making bears echoes of the president's own liberal insurgency - some called it betrayal - against his Socialist predecessor and former mentor Francois Hollande.
Caught off-guard by the momentum building behind Villani, who gathered 800 people at a rally in July and has become the darling of the Paris chattering classes, Macron failed to draw the lessons of his own political ascent, analysts said.
Senior LREM officials initially dismissed Villani's ambitions as doomed to failure.
Increasingly, however, as a Villani candidacy looked more likely, the LREM has fretted over how to deal with it: wait and hope the bid falters or kick Villani out of the party and risk strengthening his anti-establishment aura.
"Cedric is a mathematician, but he should be more calculating. Division leads to failure. Unity means victory," Richard Ferrand, a member of Macron's political guard and the head of the lower house of parliament, said last week.
SHAKING THINGS UP
Instantly recognisable for his ascot neckties and spider brooches, Villani in 2010 won the maths equivalent to the Nobel Prize, the Fields Medal, for what the award called "proofs of nonlinear Landau damping and convergence to equilibrium of the Boltzmann equation".
In politics, however, he has struck a chord with voters.
"He has a simple strategy. He wants to be true to the original Macronist narrative: someone with no party structure who will shake up the establishment," Frederic Dabi of pollster Ifop said.
Stephane Rozes of strategy consulting firm Cap said Macron appeared to have mistakenly believed that any candidate running under his banner would be elected in Paris. His party won more than a third of the votes there in May's European election.
Griveaux is a divisive figure who alienated many within his own camp after his selection by referring to party rivals as "arseholes" among other insults in a leaked conversation with journalists.
"Paradoxically, choosing Griveaux was very 'old world'. Cedric Villani is going to deploy in Paris what led to Emmanuel Macron's victory in France," Rozes said.
Macron has yet to personally endorse Griveaux, which Rozes said could leave the door open to the president later swinging behind the mathematician if Griveaux's bid crumbled.
Villani's entourage has been careful not to frame his bid as a challenge to Macron's authority. "Cedric Villani told Emmanuel Macron and (Prime Minister) Edouard Philippe his possible alternative bid in Paris will not be an act of defiance towards them," a source close to Villani told Reuters this week. (Additional reporting by Leigh Thomas Writing by Michel Rose Editing by Mark Heinrich)