A swap is a legal commitment between two parties to exchange cash flows over a pre-specified period. For a standard IRS the amount payable at each scheduled date is fixed at the onset of the agreement for one of the party (the fixed payer), while it is variable (floating), for the other party. The floating payment will be indexed to one of the points on the yield curve for interest rate swaps (say 3 month Libor) or to an equity performance for equity swaps.
Party B could be entering into this swap agreement on the assumption that interest rates will move favorably, in its case if interest rates fall over the period of the agreement. It is also possible that B has fixed-rate obligations (for example if it has issued a bond promising to repay a fixed rate to investors), but earns a payment based on a floating rates from its investments. Entering into the swap allows B to retain anything it makes from its investments above the floating rate.