The Championship club’s month-long search has ended having sacked Michael Duff on December 4 and agreed compensation with Notts for the 43-year-old.
Williams led County back to the EFL last season with promotion via the National League play-offs and leaves the club fifth in League Two.
His assistant Ryan Harley and first-team coach George Lawtey have also made the move from Meadow Lane and the new management team will be in charge for Saturday’s FA Cup third-round tie against Morecambe.
Williams previously worked at Swansea as assistant manager to Russell Martin before taking over at Notts in June 2022.
Notts County scored 117 goals last season and their total of 55 this term is the highest across England’s top four divisions.
A Swansea statement read: Williams’ appointment follows a thorough and extensive search for a head coach who can deliver the types of performances and results Swansea City need to achieve our goals while exhibiting a commitment to a brand of football in-keeping with the club’s best recent traditions.