A submarine swap is, in essence, a smart contract very similar to the HTLC contract that lightning nodes use to send, route, and receive payment through the lighting network. If you need a refresher on the details of how HTLCs work in the Lightning Network, you can read this blog post.