When you go to make a swap, your information is typically published to the public mempool, with that information, the actor then runs a transaction in ‘front’ of your own, but at a price that drives the price up for your own trade. They then immediately followup after your own transaction has been processed, with another transaction, this alters the price again and puts their transactions in line to profit at your expense.