When using a decentralized exchange (DEX) to swap tokens that aren't native to the network, granting an allowance is necessary for security and convenience. Decentralized exchanges operate via smart contracts, which require permission to interact with your tokens. By granting an allowance, you authorize these smart contracts to access and manage your tokens within the confines of your approval, ensuring that only authorized parties can engage in token swapping.
This security measure prevents malicious contracts from accessing your tokens and streamlines the swapping process by eliminating the need for individual transaction approvals, ultimately facilitating a smooth and efficient decentralized trading experience.