Lieu, a Democrat from Torrance who is favored to succeed retiring Rep.
"I was surprised and thrilled," Lieu said in an interview later, adding he had about 10 minutes' notice before Obama walked through the door, trailing staff and reporters.
Israel is in California to help
He and Lieu had planned to greet workers who were making telephone calls to support Democratic Reps.
Entering the second-floor building at 4:44 p.m., the president greeted volunteers.
"How's it going? How are you? Good to see you," he said.
"Thank you, guys. We only have a few weeks left and California is right at the heart of the battle for control of the House," Obama said, adding "the day-to-day work you're doing … it makes a difference. That's how I was elected."
Obama noted that Lieu had a "hard-fought primary," and told him that "state senators make outstanding members of Congress." Obama had been a state senator in Illinois and Lieu reminded him he had been an early supporter when Obama first ran for president in 2008.
"'That's because you knew I was a state senator,'" Lieu said the president responded.
Obama then made the rounds, joking that if he was not "directly shaking" a worker's hand, they should be making phone calls.
He spent about 15 minutes at the headquarters before his motorcade left Venice, with throngs of supporters lining the streets, en route to a fundraiser in Brentwood.