William Joseph Molloy got angry with the worker after refusing to let him into the Royal Sovereign Hotel in Normanton.
Leeds Crown Court heard Molloy had stayed at the premises in Wakefield Road but had since moved on.
He returned in the early hours of August 2 and told the security guard at the gate that he wanted to collect the belongings he had left behind.
The employee told Molloy he was unable to help and asked him to return the next morning, prosecutor Nicola Hoskins told the court.
But the 31-year-old then started banging on the door after the goalkeeper locked it and hurled racial slurs at him.
He then pulled his pants down to expose himself and shouted more obscenities.
Police were called and Molloy was arrested shortly after, telling police he was sorry for shouting the racial slur.
In his next interview at the police station, he then bizarrely denied saying anything obscene to the security guard.
Molloy, who was held on remand at HMP Leeds, appeared in court via video link from prison.
Read more
Read more
Daughter ‘scammed’ her grieving mother and spent money on drugs and partying
He previously pleaded guilty to indecent exposure and racially aggravated harassment.
Mitigating on his behalf, Anthony Sugare told the court it was simply a “spontaneous” act and he pleaded guilty at the earliest opportunity, despite his previous denials.
He said Molloy also suffered from mental health issues.
Judge Tom Bayliss QC handed Molloy eight weeks behind bars and told him: ‘It was disgraceful behavior and therefore it must be an immediate prison sentence.’
Molloy was already on a suspended sentence for robbery when he committed his final offences.
He was sentenced to 18 months in prison, suspended for two years, in October last year.
But Judge Bayliss chose not to trigger that sentence after careful consideration.
He added: “I think the best way to keep yourself out of trouble is to keep that suspended sentence hanging over you.”