DApps (decentralized applications) like Decentralized Exchanges (DEX) use smart contracts to execute transactions on the blockchain. DEXes like Uniswap or PancakeSwap uses a smart contract which allows a user to exchange their tokens to another token. A user must first give permission for the smart contract to spend a certain amount of your token (called an allowance). This also acts as a security measure for token holders, since this will limit what the smart contract can only spend in your behalf.
Additionally, this protects the DApp developers and allows the smart contract to function properly. By approving your token, you are allowing the DApp smart contract to validate how much of the token you truly have. Token approvals are also being used in staking DApps, where a user would lock their tokens to earn interest or other assets.
When doing a Swap, you will be first required to Approve the token in order to have it swapped to another asset. Once that is confirmed, you can then proceed with swapping your tokens.
Some DApps will require you to give permission for a token to be enabled for Staking. Here is an example from C.R.E.A.M. Finance where $TWT has to be Enabled first.