A swap creates financial balance between cash inflow and outflow thus making it easier for the parties to meet specific financial obligations. Both of them can help each other in need by not creating any difficulty or stress in normal operations of one another.
For example, consider firm A has an obligation to pay a fixed rate interest payment of 5%, while party B has an obligation to pay a floating rate interest payment of LIBOR + 1.5%. But party A wants to have a floating rate payment while party B wants to have a fixed rate payment. In such a case, both the parties would agree to an interest rate swap where party A would pay an interest payment to B at the rate of LIBOR + 1%, and party B would pay an interest payment to A at the rate of 4.6%.
Thus the net payment of A would be (LIBOR + 1 + 5 – 4.6) = LIBOR +1.4%
The net payment of B would be (4.6 + LIBOR + 1.5 – (LIBOR + 1)) = 5.1 %