Mr Philippe, 46, is not from the president's new centrist party but from the centre-right Republicans.
The choice is seen as an attempt to draw in key figures from both the right and left of French politics.
The announcement forms part of a busy first day for the president - he is due to meet Chancellor Angela Merkel in Berlin.
The naming of a new prime minister, Mr Macron's first big appointment, came after hours of fevered speculation in France and a day after he was inaugurated as president.
Already tipped as favourite for the job, Edouard Philippe, mayor of the northern port city of Le Havre, has long been close to Alain Juppé, who was runner-up in the race for the Republican presidential nomination in November 2016.
Who is Edouard Philippe?
For years he has been seen as Alain Juppé's right-hand man and backed his unsuccessful 2016 bid to secure the centre-right presidential nomination. He quit the Republican campaign when the chosen candidate, François Fillon, was engulfed in a "fake jobs" investigation.
Earlier this year he likened Mr Macron to Brutus's despatch of Julius Caesar in his treatment of President François Hollande.
Before he became mayor of Le Havre, he worked in the private sector and co-wrote a political thriller with Gilles Boyer, who went on to run the Juppé campaign.
Why reaction is mixed
Several weeks ago, Mr Macron tweeted that he was keen on selecting a woman prime minister, and there was some disappointment on social media that he had so far failed to choose a woman for any cabinet role.
In Mr Philippe's own Republican party, reaction to his appointment was mixed. Alain Juppé praised the new prime minister as a man of "great talent". Another leading Republican, Bruno Le Maire, welcomed the appointment as an attempt to overcome old political divisions.
But party secretary-general Bernard Accoyer said there was no political agreement between the two parties. "Will this new prime minister support the president's En Marche candidates... or the candidates of his political family?" he asked.
President Macron faces crucial parliamentary elections next month and may need the support of the centre right to push through his planned economic reforms.