What should I do if someone submit a review of a manuscript in journal system sooner than I know and I already prepared a detailed review?
I understand that this proxy review may be a cultural norm where you are. Nevertheless, it is considered malpractice in many places, and admitting to doing this can land you in trouble. Keep that in mind, because a publisher like Elsevier is massively cross-cultural, so they may take umbrage to something like this if it is reported.

Now, coming to what you get out of it. Your learning has happened anyway; I'm sure you expanded your understanding by reading all the references etc. At no point were you getting any credit for it - certainly not from journal,  probably not from supervisor (I understand this particular review was not done with his knowledge). So there's no reason to be upset. I would suggest conserving your energies. If anything, you could show your supervisor your review, just so he knows how hard you worked. But if he is as lazy and uninterested as the question makes him sound,  he may dismiss it.

Bottom line is, don't be upset. You volunteered to do the review by proxy and didn't inform supervisor what you were doing - so it's hard to find fault with anyone else. Learn from this incident and move on.