The second bolded is your answer to the first bolded. Bolt had to work for the 100m gold in this Olympics, but he won and broke records in 2008 and 2012 by hilarious margins. It's sort of a quantity versus quality argument. Phelps won more events, but Bolt won his events with mind-boggling ease. Not to say Phelps didn't win a lot of races with ease as well, but his margins of victory were typically less outrageous than Bolt's. I personally feel that we're less likely to see another Bolt emerge than another Phelps, so I lean towards Bolt in the comparison.
I was interested in how the two compared in margin of victory at the Olympics so I decided to look it up.
100M
1. Carl Lewis (1984) - 0.20s
1. Usain Bolt (2008) - 0.20s WR
3. Bob Hayes (1964) - 0.19s WR
4. Maurice Greene (2000) - 0.12s
4. Usain Bolt (2012) - 0.12s
200M
1. Usain Bolt (2008) - 0.66s WR
2. Michael Johnson (1996) - 0.36s WR
3. Tommie Smith (1968) - 0.23s WR
3. Usain Bolt (2016) - 0.23s
5. Shawn Crawford (2004) - 0.22s
200M Freestyle
1. Michael Phelps (2008) - 1.89s WR
2. Yannick Agnel (2012) - 1.79s
3. Michael Gross (1984) - 1.66s WR
4. Mark Spitz (1972) - 0.95s WR
4. Sergey Koplyakov (1980) - 0.95s
100M Butterfly
1. Joseph Schooling (2016) - 0.75s
2. Mark Spitz (1972) - 0.31s WR
3. Dennis Pankratov (1996) - 0.26s WR
4. Michael Phelps (2012) - 0.23s
5. Lars Frolander (2000) - 0.18s
200M Butterfly
1. Mark Spitz (1972) - 2.16s WR
2. Melvin Stewart (1992) - 1.67s
3. Michael Gross (1984) - 1.30s
4. Dennis Pankratov (1996) - 0.93s
5. Michael Phelps (2008) - 0.67s WR
200M Individual Medley
1. Michael Phelps (2008) - 2.29s WR
2. Michael Phelps (2016) - 1.95s
3. Michael Phelps (2004) - 1.64s
4. Alex Baumann (1984) - 1.63s WR
5. Tamas Darnyi (1988) - 1.44s WR
400M Individual Medley
1. Ryan Lochte (2012) - 3.68s
2. Michael Phelps (2004) - 3.55s WR
3. Tamas Darnyi (1992) - 2.61s WR
4. Tom Dolan (2000) - 2.47s WR
5. Michael Phelps (2008) - 2.32s WR
I also looked at how the current world records they hold compared to the 2nd fastest person ever at that distance and how much they broke their first world record by. Obviously the margins will be different in swimming and track.
Bolt
100M
Broke world record 3 times
Margin of first WR: 0.02s
Margin over 2nd fastest person ever: 0.11s
200M
Broke world record 2 times
Margin of first WR: 0.02s
Margin over 2nd fastest person ever: 0.07s
Phelp
100M Butterfly
Broke world record 2 times
Margin of first WR: 0.18s
Margin over 2nd fastest person ever:0.19s
200M Butterfly
Broke world record 8 times
Margin of first WR: 0.26s
Margin over 2nd fastest person ever: 1.19s
400M Individual Medley
Broke world record 8 times
Margin of first WR: 0.67s
Margin over 2nd fastest person ever: 1.36s