Because if you had taken the bishop on d7, you would have had a fork on a4 with your queen of the king and knight.
thank you for the explanation