I am sure there's a canonical question this should be a duplicate of, but the right answer is always:

1. Get a firm written offer in hand from another company (after any negotiation of terms)
2. Accept it, with a defined start date greater or equal to the notice you will provide in step 3
3. Notify your current direct manager and HR rep of what your last day at your current company will be, giving customary notice (2 weeks here in the US, or whatever is contractually agreed or failing that customary in your locale).  Doing it in person (or failing that verbally) with your manager is considered polite, but back it up immediately with emailing a signed letter to both parties.
4. That's it. Participate in good faith in information transfer, closing up work, or whatever they want you to do (including stopping coming to work) during your notice period. Usually it is considered a bad move to consider counteroffers to stay at this point.
5. Leave and go to work for the new company. Do not do work for your previous company unless a) you are very well compensated as a contractor and b) your new company/local laws permit such moonlighting.

Under no circumstances do you do any of this different or out of order (except in the extremely unusual case that there are contractual terms preventing it).  You do not:

1. Tell anyone at your current company "I'm leaving, no really" before you have accepted a written offer, because they may fire you or jack with you and you are not sure you have employment set up.
2. Give too short notice - the new company knows you're employed and know two weeks is customary.  If they balk at you saying "Well of course I need to provide two weeks notice" then they are sketchy and you need to keep looking.
3. Anything else that varies from the sequence above.

This sequence is the norm and it's the norm for a reason.  It's expected by employers.  It protects your interests maximally.  People are always tempted to vary from this to be "nice" or to "convince their current company to change their ways" but if they do they are just being chumps.