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.