The magistrates' court also heard that John Timpson, from Jefferson Court in Derry, had planned to put on fake tattoos as part of his escape when he stole the money in January.
He has been in custody since the theft occurred and was being sentenced on Monday, having already admitted his guilt.
A prosecution solicitor told Deputy District Judge Oonagh Mullan that Timpson went into the Danske Bank branch at Shipquay Place just before 11am on January 17.
He was recorded on CCTV taking his place in a queue and talking into his mobile phone while observing a customer in another queue who was cashing two cheques for £2,500.
When the customer left the bank with the money inside an envelope, Timpson followed him and spoke to two men in the street outside.
As the customer walked into nearby Waterloo Place, Timpson was then recorded on city centre CCTV cameras running from behind the man, grabbing the envelope and running in the direction of the bus depot at Foyle Street.
He boarded a bus at the Ulsterbus depot and offered the driver £20 to drive him to Omagh. The driver told Timpson that the bus had earlier broken down.
When Timpson got off the broken down bus he had boarded, he ran off but left his jumper behind. It was forensically examined and Timpson's DNA was found on it.
When police searched Timpson's flat, they found notes relating to the theft.
They stated that he had planned to take a change of clothes with him on the day of the theft and to put on fake tattoos in a bid to conceal his identity. He had also written down an escape route and a prepared alibi.
Timpson's defence counsel said his client had told the police "he had a complete memory blank of the incident because of his mental health issues".
The barrister added that Timpson thought that the plan was a glamorous way to obtain a substantial amount of cash.
"Instead, the reality is it was naivety which resulted in him having to endure a difficult six months in custody," he said.
The money was never recovered and, in sentencing Timpson, the judge described his offending as both pre-meditated and opportunistic.
"I read in the pre-sentence report that your motivation was to purchase alcohol and illegal substances for both yourself and your peer group," she added.
Timpson was jailed for eight months.