The Ethereum network does not refund fees for failed transactions because miners had to process the transaction in order to determine it failed. Unfortunately, there is no way to refund those fees, but the tokens you attempted to swap are returned to your wallet.
Some common reasons for failed transactions include:
Transaction deadline expired — the Uniswap interface sets a default transaction deadline of 20 minutes in order to prevent users from executing their trades at a bad price after significant price movement. Your transaction may reach the deadline if your gas price has not been set high enough.
Slippage limits — the Uniswap interface sets a default slippage limit of 0.5%. This slippage limit refers to the difference between your expected output and the real output at the time of trade execution. If the price changes by more than your set slippage limit the transaction will revert.
Some tokens such as fee on transfer or deflationary tokens are not supported by the Uniswap v3 router. Any transactions with these tokens will automatically fail.