The 50-year-old replaces Mark Kerr at Somerset Park and will oversee his new team for the first time when they visit Championship leaders Hearts on Saturday.
Hopkin resigned as Morton manager in December to help ease financial strain at the Greenock club, but two months later he finds himself tasked with keeping Ayr in the second tier.
They sit seventh, just one point ahead of the relegation play-off spot, and Hopkin’s first assignment is against the team at the top of the table.
Hearts beat Ayr in both previous meetings this season and will be out for a third victory to stretch their lead further.
Hopkin was the favourite to land the Ayr job earlier this week and has now signed a two-year contract with the club. He famously helped Livingston to successive promotions in 2017 and 2018, taking them from League One into the Premiership.
Speaking about the appointment on his club’s website, the Ayr United owner David Smith said: “We are delighted to get our man.
“The number and quality of applications were excellent and we thank everyone who showed interest in becoming the manager of Ayr United. It was quite a task to shortlist the applications, and the candidates who were interviewed were all very strong.
“When we spoke to David it became obvious that there is a synergy between what we as a club want to achieve, and the aspirations and ambitions that he has for Ayr United.
“As a board, we all felt very comfortable speaking with him and he has a calm confidence in his ability to take our club forward. We had a number of criteria that were key to the appointment and David Hopkin ticks every box.
“We all can’t wait to get going alongside Davie White and Derek Stillie who have done an incredible job of inspiring the players into climbing the table. Personally, I can’t thank them and Tommy Tait enough for what they’ve done.”
As well as Livingston and Morton, Hopkin briefly managed Bradford City during the 2018/19 season.