The world number one, who beat Maria Sharapova in the final at Roland Garros last year, was well below her best, making countless unforced errors as Muguruza deservedly triumphed.
The unseeded Spaniard broke the famous Williams serve five times in total, sealing the win when the American sent a forehand return into the net.
Williams was on course to take on sister Venus in the third round, but it was bad day for the family as the elder sister also exited, going down 2-6 6-3 6-4 to Anna Schmiedlova.
Flavia Pennetta was another high-profile casualty as the 12th seed lost out 5-7 6-4 6-2 to world number 99 Johanna Larsson, the Swede battling back from a set down to progress to the next stage.
The Italian recovered from a break down at 4-5 in the first set to win the next three games and take the lead.
Larsson hit back in the second, claiming a crucial break in game nine to set up the opportunity to level the match and then dominated the decider, surging into a 4-0 lead before holding out comfortably to shock her opponent.
The Swede will now face 18th seed Eugenie Bouchard, who came from a set down to beat Julia Goerges 2-6 6-2 6-1.
Sabine Lisicki, the 16th seed, was forced to retire with an injury to her right wrist when 6-1 3-0 down to Mona Barthel, and Alize Cornet was another to suffer a surprise exit, losing out 6-4 4-6 6-4 to world number 205 Taylor Townsend.
Third seed Agnieszka Radwanska enjoyed a much more positive outcome as she breezed past Karolina Pliskova 6-3 6-4, while other top 10 seeds to progress on Wednesday were Maria Sharapova, Angelique Kerber and Dominika Cibulkova, who all enjoyed straight-sets victories.
Sharapova, runner-up in 2013, recovered from being an early break down to see off Tsvetana Pironkova 7-5 6-2.
Kerber was similarly comfortable in overcoming Varvara Lepchenko 6-2 7-5, and Cibulkova had little trouble in advancing 6-3 6-4 against Tamira Paszek.
Cibulkova will now come up against Sam Stosur, 6-1 6-3 victor over Yvonne Meusburger, and Kerber takes on Daniela Hantuchova, who came through 6-1 6-4 against Claire Feuerstein.
Carla Suarez Navarro saw off Timea Bacsinszky 7-5 1-6 6-4, while Ajla Tomljanovic knocked out Elena Vesnina 7-6 (8-6) 6-2.
The matches between Pauline Parmentier and Yaroslava Shvedova, and Monica Niculescu and Paula Ormaechea were both suspended due to rain and will resume on Thursday.