Capturing Baku was the only chance the Nazis ever had of beating the russians.
Paraphrasing: the documentary says the german fieldmarshal in Stalingrad phoned Hitler and said they badly need more troops. Hitler responded 'what good is your army without the oil you need to use it.'
I'm writing this from memory, but my memory is the only reason they were there was opportunism, they advanced faster than expected, and looked to take Stalingrad easily despite it not being a strategic target. Then when they got bogged down Hitler refused to allow retreat, he thought taking the city named for Stalin would dishearten the russian people, and a german retreat would inspire them. So he threw away a million man army he couldn't afford to lose.
And all while under-supplying the army in the Caucasus and dooming it to failure.