If you want to voluntarily leave your job, there are steps you can take to do so. First you need to recognize that you may not have a source of income for several weeks or months or for however long it might take you to find a new job. So it’s important to have money saved before you leave a job.
Ideally, you would leave your job only after you already have a new job to go to. If you were fired, again you should have some money saved to prepare for this possibility. Lots of big companies have filed for bankruptcy and laid off workers. It can happen to you, so you should also keep your resume up-to-date.