user16771: I have not been able to tell why my computer sometimes tell me that advancing a pawn from its original square in order to kick an opponent piece is right and other times wrong.
Take for instance, this game whose link is in case someone needs it: https://lichess.org/JdqqGV0Aekw4

In this case it is Ok to play a6 to kick out the knight.
However, in this position: I played the obvious Nf3.
 However, it seems that kicking out the bishop with a3 would be a great mistake. 
I feel that sometimes kicking out these annoying pieces gets me in a less superior position whereas other times it is best kicking them out before castling or proceeding with the development of pieces and that is something that really confuses me. 
I would appreciate if someone could really give some kind of rule of thumb or at least some things to consider before doing those pawns advances.

user15296: Nf3 protects the pawn on d4, which otherwise will be taken by queen during the next move.

user8258: In the second example, after a2-a3, black does not have to retreat his dark squared bishop but can instead play ...Qxd4 when after axb4 Black can follow up with Qxd3.  

16771: <p>I have not been able to tell why my computer sometimes tell me that advancing a pawn from its original square in order to kick an opponent piece is right and other times wrong.
Take for instance, this game whose link is in case someone needs it: <a href="https://lichess.org/JdqqGV0Aekw4" rel="nofollow noreferrer">https://lichess.org/JdqqGV0Aekw4</a>
<a href="https://i.stack.imgur.com/JMJXc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JMJXc.jpg" alt="enter image description here"></a></p>

<p>In this case it is Ok to play a6 to kick out the knight.
However, in this position:<a href="https://i.stack.imgur.com/Se9er.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Se9er.jpg" alt="enter image description here"></a> I played the obvious Nf3.
 However, it seems that kicking out the bishop with a3 would be a great mistake. 
I feel that sometimes kicking out these annoying pieces gets me in a less superior position whereas other times it is best kicking them out before castling or proceeding with the development of pieces and that is something that really confuses me. 
I would appreciate if someone could really give some kind of rule of thumb or at least some things to consider before doing those pawns advances.</p>
 15296: <p><code>Nf3</code> protects the pawn on <code>d4</code>, which otherwise will be taken by queen during the next move.</p>
 8258: <p>In the second example, after a2-a3, black does not have to retreat his dark squared bishop but can instead play ...Qxd4 when after axb4 Black can follow up with Qxd3.  </p>
