How does Iago trick Othello into thinking Cassio was gloating and bragging about his affair with Desdemona?
It's important to note that at this point in the play, Othello is a frothing, jealous madman who is already convinced of Cassio and Desdemona's infidelity and has already sworn to punish them both for it. So, at this point, Iago is really just taunting him further to make Othello even crazier.
Othello hides, and Iago carefully starts a conversation about Bianca with Cassio. Bianca is a courtesan/prostitute that Cassio had taken up with. Not having any idea of Iago's machinations, Cassio laughs uproariously and vulgarly talks about sleeping with Bianca, even making gestures. Needless to say, Othello thinks Cassio is talking about Desdemona.