What's the origin of Dog Day Afternoon?

This is a real incident that happened in NY in the mid-70s.  It's about this man (played by Al Pacino) who's married to a woman.  But then he also fell in love with a man.  His partner said he's trapped in the wrong body. So, Al Pacino decided to rob a bank to get money for his partner's sex change.