user14028: I was playing with a friend and we come to the following position (me white):

My friend played b5 but computer analysis says that this is a mistake and he should have played a5. Now, I don't see why is that better? 
Can anyone help me please understand why? 

user-1: After 1...a5, Black has a good attack and can win the exchange. After 1...b5, White doesn't have to retreat, but can create a material imbalance.
[FEN "r2qkbnr/pp3pp1/2pp3p/4p3/B2nP1b1/2NP1N2/PPP2PPP/R1BQ1RK1 b kq - 0 1"]

1...a5 (1...b5 2. Nxd4 Bxd1 3. Nxc6 Qh4 4. Bxb5 Bh5 5. Nd5 Kd7 6. Nxa7+ Kd8 7. Nc6+ Kc8 8. Nb6+ Kb7 9. Nxa8 Kxa8) 2. a3 {Forced. This gives the bishop an escape square} b5 3. Bb3 Qf6 {Adding pressure to the pinned f3-knight} 4. Ne2 {An attempt to break the pin and bring a defender to g3} Nxf3+ 5. gxf3 Bh3 6. f4 {Forced} (6. Re1 Qxf3 {This leads to mate}) Bxf1 7. Qxf1


user7297: First, you need to see that in the original position, Black has already a close to winning advantage. Especially the pin on f3 is nasty; it's hard for White to defend the knight now that the bishop is 'offside' and Black can easily attack it with another piece (Qf6).
Both moves (a5 and b5) share the same idea: gaining space on the queenside, with tempo. The move a5 doesn't attack anything but threatens to trap the bishop. The move b5 has a deep tactical refutation involving a (temporary) queen sacrifice:
[FEN "r2qkbnr/pp3pp1/2pp3p/4p3/B2nP1b1/2NP1N2/PPP2PPP/R1BQ1RK1 b - - 0 1"]

1... b5 2. Nxd4!! Bxd1 3. Nxc6 bxa4 4. Nxd8 Bxc2 5. Nc6 Bxd3 6. Rd1 Ba6 7. Nd5

and White has more than enough compensation for the pawn; center control, space advantage, advantage in development and a better pawn structure. (Immediate tactics on c7 look promising but aren't.)
Black is better off trying to hold on to the queen, but he'll have trouble protecting his king from the dangerous bishop-knight battery:
[FEN "r2qkbnr/pp3pp1/2pp3p/4p3/B2nP1b1/2NP1N2/PPP2PPP/R1BQ1RK1 b - - 0 1"]

1... b5 2. Nxd4!! Bxd1 3. Nxc6 Qh4 4. Bxb5 a6 5. Ba4 Bxc2 6. Bxc2 Be7 7. Ba4 Kf8 8. Nd5

This is an unbalanced position with chances for both sides; in any case, much less than Black started out with.

14028: <p>I was playing with a friend and we come to the following position (me white):
<a href="https://i.stack.imgur.com/yaPoC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/yaPoC.png" alt="enter image description here"></a></p>

<p>My friend played <code>b5</code> but computer analysis says that this is a mistake and he should have played <code>a5</code>. Now, I don't see why is that better? </p>

<p>Can anyone help me please understand why? </p>
 -1: <p>After 1...a5, Black has a good attack and can win the exchange. After 1...b5, White doesn't have to retreat, but can create a material imbalance.</p>

<pre><code>[FEN "r2qkbnr/pp3pp1/2pp3p/4p3/B2nP1b1/2NP1N2/PPP2PPP/R1BQ1RK1 b kq - 0 1"]

1...a5 (1...b5 2. Nxd4 Bxd1 3. Nxc6 Qh4 4. Bxb5 Bh5 5. Nd5 Kd7 6. Nxa7+ Kd8 7. Nc6+ Kc8 8. Nb6+ Kb7 9. Nxa8 Kxa8) 2. a3 {Forced. This gives the bishop an escape square} b5 3. Bb3 Qf6 {Adding pressure to the pinned f3-knight} 4. Ne2 {An attempt to break the pin and bring a defender to g3} Nxf3+ 5. gxf3 Bh3 6. f4 {Forced} (6. Re1 Qxf3 {This leads to mate}) Bxf1 7. Qxf1
</code></pre>
 7297: <p>First, you need to see that in the original position, Black has already a close to winning advantage. Especially the pin on f3 is nasty; it's hard for White to defend the knight now that the bishop is 'offside' and Black can easily attack it with another piece (Qf6).</p>

<p>Both moves (a5 and b5) share the same idea: gaining space on the queenside, with tempo. The move a5 doesn't attack anything but threatens to trap the bishop. The move b5 has a deep tactical refutation involving a (temporary) queen sacrifice:</p>

<pre><code>[FEN "r2qkbnr/pp3pp1/2pp3p/4p3/B2nP1b1/2NP1N2/PPP2PPP/R1BQ1RK1 b - - 0 1"]

1... b5 2. Nxd4!! Bxd1 3. Nxc6 bxa4 4. Nxd8 Bxc2 5. Nc6 Bxd3 6. Rd1 Ba6 7. Nd5
</code></pre>

<p>and White has more than enough compensation for the pawn; center control, space advantage, advantage in development and a better pawn structure. (Immediate tactics on c7 look promising but aren't.)</p>

<p>Black is better off trying to hold on to the queen, but he'll have trouble protecting his king from the dangerous bishop-knight battery:</p>

<pre><code>[FEN "r2qkbnr/pp3pp1/2pp3p/4p3/B2nP1b1/2NP1N2/PPP2PPP/R1BQ1RK1 b - - 0 1"]

1... b5 2. Nxd4!! Bxd1 3. Nxc6 Qh4 4. Bxb5 a6 5. Ba4 Bxc2 6. Bxc2 Be7 7. Ba4 Kf8 8. Nd5
</code></pre>

<p>This is an unbalanced position with chances for both sides; in any case, much less than Black started out with.</p>
