The authorities said the 39-year-old woman got into an argument with a member of staff in the Rhine-Main Jobcentre's section for homeless people and those with addiction problems.
When she refused to leave and the argument became increasingly loud, security and then the police were called to get her to go.
After the police officers who arrived on the scene asked for her identity papers, the woman opened her handbag and took out a knife. She then attacked the male officer, injuring him badly in the abdomen and upper arm.
His colleague pulled her gun and shot the woman once in the stomach - she later died of her injuries in hospital. It is not yet known what caused the argument.
"We're all completely under shock," said one job centre employee.
The Frankfurter Rundschau newspaper reported that the injured policeman is in a stable condition in hospital while his colleague is said to be shaken by the incident. State criminal police have sealed off the building as a crime scene and are gathering witness statements and potential evidence.
“Today is sad proof that violence against the police is increasing,” said police union leader Jörg Bruchmüller. ”We are confronted daily with such violence (but) the police are not society's maintenance crew.”