In cryptocurrency a DEX is a Decentralized peer-to-peer Exchange. It is an exchange run by code. It usually exists as a decentralized application (DApp). It is a place where people can trade cryptocurrencies directly without a middleman.
Cryptocurrencies were first started to be money that individuals owned that had value based on its use alone. It was not dependent on economies, governments or any other institution. Specifically, it did not have a central bank or authority that controlled the currency.
When Bitcoin took off, cryptocurrencies became mainstream. However, not every mined crypto. To participate in the crypto revolution, they exchanged fiat money (Dollars, Pounds, Euros) for bitcoin. This led to a booming exchange business for cryptocurrencies. Among the main ones were Binance, Upbit, Coinbase, etc. They performed a simple function. They traded fiat-to-crypto and crypto-to-crypto. This system worked well until recent hacking episodes where crypto were siphoned off, never to be seen again. The FATF and other regulatory bodies also started curbing or outright banning cryptocurrencies. The problems with exchanges lay in the fact that these entities were built in a centralised manner. They could be targeted by hackers and governments as a result.
Decentralized cryptocurrency exchanges are designed to solve this problem. While crypto was decentralized, the exchanges were not. Decentralized exchanges applies the same logic of cryptocurrency to exchanges. In this system, there is no central authority. Everything is stored in the block chain and is completely P2P or peer-to-peer.
Although generally a DEX will have no middleman when it comes to trades (all trades are between two peers), there are generally developers who manage the platform and aspects of a DEX thus won’t be fully decentralized. In general a DApp needs a front end, and that front end is often not coded onto a blockchain, and thus must be managed to some degree. Likewise, a team of developers may end up working on the code, and who works on the code may be controlled by a team. Also, developers may be able to do things like add and remove coins for trade. In sum, how much outside control there is can differ by exchange, but since the code had to be created by someone and since aspects of it have to be managed, in general a DEX is not fully decentralized, just specifically the trading is.
Since transactions on a DEX are recorded on the blockchain, 1. they can be slow to process if transactions are congested and 2. they have no way to reverse transactions. So if you make a bad trade, even by accident, there is no way to undo it in general with a DEX.
You might also like: What can you buy with Bitcoin?