The short version of your story is that the DM guiding a group dive was at fault because you ran low on air and expected him to provide additional air at depth so you could continue your dive, so when he didn't, you continued the dive anyway, drained your tank at depth and then the DM rescued you when you all but ran out of air.
WOW - just WOW - so far the responses have been very restrained. I would suggest that you go back and reread them and try to learn from them as opposed to berating those who were trying ever so gently to educate you.
You - and only you - are responsible for getting yourself to the surface. Not your buddy, not a DM, not your instructor, not the boat captian, not God ... you.
Don't care if you are doing your first dive after OW or your 500th dive, unless you have specifically hired someone to take care of you while diving - which was not the case here - you are responsible for you. Assuming that someone else will take care of you is just a bad idea and has the potential to kill you. Take this as a learning exercise, the DM did nothing wrong here, and frankly I would bet that he was pissed at you for running out of air twice in one day and forcing him to deal with that rather than ensuring all of the divers in the group had a great dive.