A swap is the adjustment made to your account when a position is held past the daily rollover. Mechanically you are borrowing one currency to hold the other, so the difference between the two interest rates has to be settled. The charge is small per night, which is exactly why it is easy to ignore until a position is held for weeks.
The direction matters. If the currency you bought carries a higher interest rate than the one you sold, the long side usually receives and the short side pays. The broker takes a margin on top of the raw differential, so both directions can end up negative, particularly on exotic pairs and on accounts with high leverage. Most instruments roll over at the server daily close, and many pairs apply a triple charge once a week to cover the weekend.
The practical approach is to treat swap as part of the cost of the trade rather than a separate line item. For intraday work it is noise; for positions held over weeks it can quietly consume the profit you were targeting. Check the published swap table for the instrument before you plan a long hold, and be careful with the idea of holding a position purely to collect the differential: the currency move that goes against you is usually larger than the interest you were chasing. This is general educational content, not investment advice.