Due to some personal reasons, I didn't get to complete my semester end project. So I copied my friend's project and submitted it without major changes (I know I was a fool to do that). Now we are caught and my TA told us that both of our scores will be zero. I have begged the TA to give my friend his score, at least. I don't know what is going to happen. I am obviously going to fail this class, but I don't want my friend to fail it because of me. What should I do?
Whether your friend deserves a grade or not depends whether he was a willing accomplice or an innocent victim. If he was a willing accomplice, then probably both of you failing the class is the best thing you can hope for (at least for most US universities, where there are consequences besides failing if the professor or TA chooses to report it). If he was a victim (he did not share his project with you with the intent that you could just copy it), then he certainly merits a grade.
In any case, the proper thing to do is for you to arrange to meet the professor in person, explain the situation, and apologize. If your friend was a knowing accomplice, both you and your friend should go together. Then it is up to the professor.
The only thing you could really do is go talk to the professor and confess.
As far as your friend's grade goes, that is up to the professor. If you stole your friend's work then he certainly shouldn't be affected. If he was just helping you (which it doesn't sound like) then the professor might also take that into account.
You should expect to get a zero but I have seen a situation where the professor gave the student another chance (e.g., extended the deadline and allowed the student to redo the assignment) and didn't penalize the person who originally did the work.
Of course, you shouldn't expect any of these favorable outcomes since you admitted you are in the wrong but it is still good to always talk things through.
You don't give us enough info about your friend's role in it.
If he knew/helped/whatever and didn't stop it then he will get (and deserves) the zero right along with you.
If not then he may still get the zero, though he doesn't fully deserve it, and that would basically put you on the "worst friends ever" list for doing that behind his back.
If the friend didn't know you were doing it then you need to be not only confessing that you cheated, but also confessing that you stole it from him without his knowledge or consent and making sure they know he was totally innocent all around. Then and only then is there a shot of him not getting a zero.
Your friend isn't failing because of you; they are failing because they committed a serious breach of academic ethics in giving you their assignment to copy or even to use as a guide. By acting as your accomplice they are as much a party to your cheating as you are and, as such, they do not deserve any marks.
You and your friend can do little but beg for leniency this time. In future, do not put your friends in the position of choosing between acting ethically and helping you out by cheating.
but I don't want my friend to fail it because of me
Glad to see you repent your action. If you are looking for a safe play, I can assure you there is none if your TA is sincere in their words. The ideal thing to do is to
Submit the case before a competent authority (your professor in this case) and be truthful to the investigation.
If the premise is correct in the question, your friend will be granted with the grade he deserves. Bear in mind that there will be consequences for you, severity of which depends on the particular country or the university and your professor.