The Argentina international has scored over 90 goals in all competitions since Guardiola's arrival and has been a key player in their push for the quadruple this season.
Asked about his relationship with the striker and reports of issues when he first arrived at the club, City boss Guardiola told Sky Sports: "It's the media. I understand because sometimes he didn't play and then people asked why he didn't play, but he knows the reason why.
"Sometimes it was for the tactics and sometimes I wanted more, but that is my job. I have to demand the best from my players.
"But I'm happy because the Sergio I met and the Sergio I know now is the same, he's an incredible person. He's a guy who can talk, he's a funny guy and he has incredible heart. I love to work with nice, nice people and he's one of the nicest players I've ever worked with in my career.
"Sometimes you need more time to understand it and sometimes the team, not just one player, has to understand it. But Sergio was so open to doing it because I know he is so happy here. He loves playing at Man City."
Guardiola added: "He's an incredible legend, who scored the most important goal in the club's history. Even if we win all the titles this season the nicest and most incredible Man City moment in our lives is when Sergio scored with Roberto Mancini's team. That is the most important moment of this club."