The purpose of the “B” story or subplot is so that the supporting characters in the program have something to do in addition to providing reactions to and validation for the actions of the protagonist. The B story/subplot interweaves with the main story and often provides the main story with added measure of heft that it may lack to to editing and the need to get the episode filmed.
if you watch sitcoms from early American television, subplots were rarely used and the weakness of the main stories became readily apparent. The action was concentrated around the protagonist(s) and, if the story wasn’t particularly enthralling, the discriminating viewer might find that episode to be boring and they might tune away or remember that episode as not being one of the “better” ones. With a subplot, you can retain the interest of the viewer by providing them with a number of story elements, you keep the cast happy as all of the supporting actors have distinct roles within the series and you keep the writers happy as they demonstrate their creativity and potentially expand the underlying legend of of the series.
A different format is the A-B-C format, where an additional subplot is added; however this usually occurs on special hourlong episodes or when the series has been on for a number of seasons, Another variation is the “A Christmas Carol/It’s a WOnderful Life type of episode where the protagonist is shown how their life intersects with those of the supporting cast in way which they are unaware. This is a “cheat” as it allows the entire episode to be about the protagonist without appearing to actually be that way.