What should PhD students do if they submit a paper to two journals and a reviewer notices concurrent submission? I am in a desperate situation. I made a mistake and committed academic misconduct.

I have submitted my article to two journals in parallel, let's say in j1 and j2. Once I received acceptance from journal j1 I wrote a withdraw email to j2.

However, after the article came online it was found by the reviewer of j2 that the withdrawal article was actually a parallel submission.

I am 3rd year PhD student and my professor was unaware of this act. How can I handle this situation?

Should I write an apology email to j2? If j2 accept the apology, will j1 keep the article or still it will be retracted?

What is the best way to come out of the situation?

*I am reviewer of both journals as well.
If you are a seasoned reviewer you should know the rules, so falling back on being an inexperienced graduate student probably won't hold water. So clearly this was less a 'mistake' and more of a 'gamble'.  You should pull the article from both venues and state -unequivocally- that your advisor had no knowledge. 

You didn't mention if your advisor was a co-author on the submission, but if he/she was, the infraction is even worse, because not only have you submitted without consent, you risked damaging their reputation with the journals as well. 

The best path forward is to own your mistake wholly and apologize. On the positive side, it's not like you committed the mortal sin of fabricating data or plagiarizing - you violated a rule (and likely the terms and conditions of the journal). Probably not grounds for dismissal but you might be on a leash for a while.  

Don't do it again!  The rule is in place for several reasons, not the least of which is respecting reviewers' time and effort (reviewers' time is precious and usually pro-bono. We can't have every journal reviewing the same work).