Over the past few weeks, Lloyd had emerged as the favorite to replace Sean Miller in Tucson. Arizona looked at coaches with connections to the Wildcats, namely Pacific's Damon Stoudamire, Georgia Tech's Josh Pastner and Los Angeles Lakers assistant coach Miles Simon, but the program opted to go outside the family.
Lloyd, 46, interviewed over the weekend, sources told ESPN.
The school said in a statement that Lloyd will get a five-year contract.
"While there are certainly potential obstacles ahead for our program, I embrace the challenge as we will build on the foundation in place to compete for Pac-12 and national championships," Lloyd said in a statement.
Lloyd has been at Gonzaga since 2000, serving as an assistant coach under Mark Few for the past 20 seasons. The Bulldogs have reached the NCAA tournament in every season since Lloyd joined the program. They reached the national championship game twice, in 2017 and this past season, when their unbeaten record was ended by Baylor.
Lloyd is established as the best international recruiter in college basketball, bringing dozens of overseas players to the Zags over the past two decades. International prospects who played at Gonzaga and were drafted since Lloyd joined Few's staff include Ronny Turiaf, Robert Sacre, Kelly Olynyk, Domantas Sabonis and Rui Hachimura.
That could be important when he takes over at Arizona, which had seven international players on its roster this past season, including Lithuania native Azuolas Tubelis and Canada native Bennedict Mathurin.
"There was never a master plan," Lloyd told ESPN last year about his international prowess. "It was just one day at a time. One phone call, one relationship, one recruit. And then once you start having success, more opportunities present themselves."
He also played a key role in helping Gonzaga secure five-star prospects Jalen Suggs and Hunter Sallis in the past two recruiting classes, has the Zags in position to land No. 1 overall recruit Chet Holmgren and also led the way in landing impact transfers like Brandon Clarke and Kyle Wiltjer.
The coach-in-waiting at Gonzaga, Lloyd had turned down multiple opportunities to interview at other jobs over the past several years. But Arizona, despite the question marks looming over the program, is considered one of the elite jobs in college basketball.
"I'm fulfilled," Lloyd told ESPN a year ago. "I love being at a place that's bigger than any of us on the coaching staff. We're all part of something bigger than ourselves. And I think that's something pretty special."
Lloyd replaces Sean Miller, who was fired earlier this month after 12 seasons in Tucson. He led the Wildcats to seven NCAA tournaments and three Elite Eight appearances, but had reached the second weekend of the NCAA tournament just once since 2016. The Wildcats won at least a share of five Pac-12 regular-season championships under Miller.
Arizona had been entangled in the 2017 federal investigation into corruption in college basketball. Former assistant coach Emanuel "Book" Richardson pleaded guilty to one felony count of conspiracy to commit bribery after being accused of accepting $20,000 to steer Arizona players to aspiring sports agent Christian Dawkins. During Dawkins' trial, prosecutors played an FBI-intercepted call in which Richardson told Dawkins that Miller was paying $10,000 a month for former player Deandre Ayton.
Miller has consistently denied paying players to attend Arizona.
The NCAA charged the men's basketball program with four Level I violations, according to a notice of allegations released last month. The program was hit with two alleged instances of academic misconduct, while Miller was charged for not demonstrating "that he promoted an atmosphere for compliance and monitored his staff."
Arizona self-imposed a one-year postseason ban for this past season.