Think of RAM as your desk and swap as a filing cabinet. The desk is fast but tiny; the cabinet is slow but huge. When the desk overflows, you move the oldest papers to the cabinet. When you need them again, you drag them back — slower than if they had stayed on the desk, but faster than losing them.
A system without enough swap under memory pressure will start killing processes (OOM killer). A system with too much swap pretends it has RAM it doesn't really have — paging hurts performance. Modest sizing (~2× RAM for small boxes, smaller for servers with lots of RAM) is the rule of thumb.