Novice Needs Help


Capturing the bishop was better because after you castled black can capture your d pawn for free.
"To take is a mistake" is generally good advice for when you're unsure what to do, but as a beginner the most important thing you can do is not lose pieces for free.

Actually I made a topic about this recently, you might find it useful:
https://www.chess.com/forum/view/for-beginners/the-most-important-concept-for-all-beginners
think of exchanging as removing a defender of something, for both sides. we know that every piece controls squares and/or defends another piece. then see whether that something left undefended can be captured or, in case of a square, occupied. do this for your side and the opponent. then you should be able to decide whether it is worth exchanging on any given turn or not. hopefully this makes sense.