The Ivory Coast international, who has signed a four-year contract, is the first player to join United since Jose Mourinho was appointed manager.
Bailly, 22, said: “It is a dream come true to be joining Manchester United. To play football at the highest level is all I have ever wanted to do.”
Mourinho said: “Eric has the potential to become one of the best around.”
Bailly has played 40 times in La Liga, the first five games being for Espanyol.
He joined Villarreal for £4.4m in January 2015 and played in every match as Ivory Coast won the Africa Cup of Nations just weeks later.
Bailly said: “It is a confidence boost that a manager with so much experience of English football has trusted in me by making me his first signing.
“English football has a different style to Spanish football. It’s more physical and more direct as well. I have always thought it would suit my style of football.”
United are also tipped to complete the acquisition of Paris St-Germain striker Zlatan Ibrahimovic.