Hornby will start work at the company, which owns the Boots brand in the UK, in mid -July.
He was chief executive of HBOS last year when the bank nearly collapsed under the weight of £11bn in losses. Hornby, who became the youngest ever boss of a major high street bank in 2005, left after the bank was acquired by Lloyds TSB.
Alliance Boots was created by the merger of Boots the chemist and Alliance Unichem in 2006. It was subsequently bought by private equity firm KKR in 2007 in a deal believed to be worth £11bn.
In the UK, the firm recently posted a 3.2% increase in sales for the year to March 31 boosted by strong sales of its No 7 cosmetics and skincare brand.
The chief executive position at Alliance Boots has been vacant since the departure of Richard Baker in 2007.
Hornby held a number of senior roles at Asda including marketing director. He is currently non-executive director of Home Retail Group, which owns Argos and Homebase.