Former Liverpool midfielder Alberto Aquilani gave visitors Milan a 12th-minute lead, but Cavani pounced for an equaliser one minute later and put Napoli ahead in the 36th minute.
He completed his treble after 51 minutes, to lift Napoli to the top of the Italian league standings, albeit after only two rounds of games.
Juventus, Udinese and Cagliari also have six points from two games, with Cagliari having been the first to reach the mark by beating newcomers Novara on Saturday.
Juventus won 1-0 at Siena, with Alessandro Matri scoring the only goal of the game in the 54th minute.
Udinese enjoyed a 2-0 home victory against Fiorentina, secured by first-half goals by Antonio Di Natale and Mauricio Isla.
Di Natale converted an early penalty before Isla fired home an unstoppable shot after half an hour.
Genoa came from behind to claim their first win of the season, 2-1 at Lazio.
Giuseppe Sculli put Lazio ahead after 11 minutes but the visitors responded well.
Rodrigo Palacio brought Genoa level before the hour mark and team-mate Juraj Kucka struck the winner with 19 minutes remaining to silence the home fans at the Stadio Olimpico.
An injury-time goal from Sebastian Giovinco earned Parma a 2-1 success against Chievo, before being sent off a minute later for a second bookable offence.
Giovinco put Parma in front in the 24th minute before substitute Alberto Paloschi equalised with 11 minutes remaining.
With the game looking to be heading for a draw, Giovinco came to the rescue and scored his second of the day in stoppage time, prior to being dismissed soon afterwards for playing on after the referee's whistle.
Atalanta, having been docked six points for match-fixing, are nudging back towards positive figures after a rain-affected 1-0 home victory over Palermo.
German Denis put the home side in front in the 34th minute, but the game was suspended after an hour when a torrential downpour rendered the pitch unplayable.
After more than half an hour's delay the referee called the players back on and Atalanta held their lead over the remaining half an hour to move to minus two points at the bottom of the table.
Maxi Lopez's first-half penalty against Cesena settled a scrappy game in Catania's favour at Stadio Angelo Massimino.
Guillermo Giacomazzi and Carlos Grossmuller grabbed the goals as Lecce earned their first win of the season, 2-0 at Bologna.