City were heading for a frustrating evening at the Etihad Stadium on Monday until Kompany let fly with a 25-yard shot into the top corner 20 minutes from time -- the centre-back's first City goal from outside the box.
Victory saw City go top by a point from Liverpool heading into Sunday's last round of league matches.
"I hadn't scored this season but I always feel in big moments that I'm going to do something, I don't know if it's a header or what," Kompany told Sky Sports.
"Today was a little bit of frustration, everyone was saying 'don't shoot, don't shoot' and I could really hear it; I thought hold on a second, I've not come this far in my career for young players to tell me if I can take a shot, and I just had a go!"
Kompany insisted: "I've scored goals like that in training!
"It's 15 years I've been in top-level football, midfielders telling me 'don't shoot, play the ball wide' and every time they miss, for 15 years I've been saying 'I promise you, one day I'm going to have a shot from outside the box and I'm going to score a goal and you're going to be really happy with that one'."
City manager Pep Guardiola admitted he too was among those who didn't want Kompany to let fly from distance.
"Don't shoot! Pass the ball, pass the ball!," said Guardiola when asked about his thoughts as Kompany took aim.
"Honestly, I wasn't too confident but football is mad for that. The artists are the players, they have to decide things in a fraction of a second and what's important isn't the goal, it's him shooting while believing he was going to score.
"He's a big believer and that helped us to win the game," the former Barcelona and Bayern Munich boss added.
"Now we don't have games every three days, he's not young and to be consistent is difficult for him every three days, but when we have a game once every week, he's an incredible player."
City will be assured of retaining the title if their result away to Brighton is equal or better to what Liverpool achieve against Wolves at Anfield on Sunday.
However, a win for Liverpool and anything less for City would see the Reds secure their maiden English championship since they last won the old First Division title in 1990.
And Kompany warned: "It's a big goal, we've not achieved anything but it was an important win against a very, very strong team."
But Leicester goalkeeper Kasper Schmeichel, who made several fine saves on Monday, said: "City are a top-class side, and we have lost to the potential champions.
"I can't see them losing their next game."