why are there unemployment when there is recession?

Companies often lay off workers when there's a recession and many people aren't spending money unless necessary.