From a purely numerical standpoint, it can only be a swimmer or possibly a total freak of a gymnast (on paper a male gymnast can win 8 gold medal in a single Olympic - in practice, the best I could find with my Google-Fu is that in 1980 the russian Dityatin managed to get 3 gold, 4 silver and 1 bronze). Swimming is still a lot more likely since a specific morphology gives an edge in all disciplines but breaststroke. So basically, the next tall guy with freakishly long arms and freakishly big feet, that has a gift for swimming, is willing to spend the hours and is from a strong swimming nation to help him score the team events is the guy that will match Phelbs' record.
Also, Phelps reached this incredible tally over 5 Olympiads. That means being a top competitor during 17 years! As time goes by and our knowledge of conditioning, nutrition, treatment, etc. improves, athletes's career should be longer and longer so maybe in 2040 a guy competing in Kayaking (5 potential gold per Olympiad) will beat Phelps tally during his seventh games! Unless Phelps himself will be back in 2020 for team events.