to relieve tension! It physically forces the reader to let out the breath they didn't realise they were holding in. It denotes a resolution to conflict and provides a segue away from heavy plot elements. Like how marvel films always have a comedic moment proceeding sad moments
It's just a trope in the "two schoolboys learn how to tell each other daisuki" type of BL because they always get really embarrassed, and people often laugh in response to embarrassment. Laughing right after a confession scene is less common in manga with more mature characters/themes.
Why is there always a panel of them laughing everytime they finally confess to each other ITS LITERALLY IN EVERY MANGA