Police did not immediately release the name of the man who was killed outside the motel, where he had been reported knocking on doors, searching for a woman.
Banning police got a call at 12:51 a.m. PDT Saturday from the motel, reporting the man was making guests uncomfortable.
"The officer arrived at the hotel within minutes and contacted the subject as the officer was exiting the hotel elevator," the Riverside County Sheriff's Department said in a news release. "The officer attempted to ascertain what the subject was doing at the hotel and the subject attempted to run away from the officer."
Police said the officer and the man became involved in a physical altercation and the man "brandished a handgun" before the officer shot him.
The man died before an ambulance arrived, police said.
The officer who shot the man was identified only as an 18-year law enforcement veteran who has been placed on paid administrative leave, while the sheriff's department homicide unit -- at the request of Banning police -- carries out an investigation into the shooting.