The 22-year-old has signed a four-year contract with the option of a further two and becomes the first arrival of the Jose Mourinho era at Old Trafford.
Mourinho said: “Eric is a young central defender with great natural talent. He has progressed well to date and has the potential to become one of the best around.
“We look forward to working with him to help nurture that raw talent and fulfill his potential. Eric is at the right club to continue his development.”
Bailly joined Villarreal from Espanyol in January 2015 as a replacement for Arsenal-bound Gabriel and went on to make 47 appearances for the Spanish club.
He 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.
“I want to progress to be the best that I can be and I believe working with Jose Mourinho will help me develop in the right way and at the right club.
“I am looking forward to meeting my new team mates and to starting this new chapter of my life.”