When you quit a job, you don't get any benefits, but you leave on your terms and therefore maintain some measure of control over the situation. With a layoff, you may be eligible for a severance package and other benefits, but it's difficult to predict when a company will do a layoff.
If a better opportunity presents itself or you feel you need to leave your workplace for any other reason, it may be better to quit than to wait for a layoff that might not even happen.