A lock is a way to claim exclusive access to a row, table, or other resource so two transactions do not corrupt each other's work. A deadlock happens when transactions grab those locks in a different order and then wait on each other in a loop.
The classic example uses two rows, A and B. Transaction 1 locks row A and then asks for row B. At the same time, Transaction 2 locks row B and then asks for row A. Transaction 1 cannot get B because Transaction 2 holds it, and Transaction 2 cannot get A because Transaction 1 holds it. Neither will give up its lock until it finishes, and neither can finish. That is a deadlock.
A deadlock is not the same as slowness or a long wait. In a normal wait, one transaction will eventually get the lock once the holder commits. In a deadlock, the wait is circular, so it would last forever if nothing intervened. There are four conditions that must all hold for a deadlock: mutual exclusion, hold and wait, no preemption, and a circular wait. Remove any one of them and the deadlock cannot form.