She is known as Xiaoice, and millions of young Chinese pick up their smartphones every day to exchange messages with her, drawn to her knowing sense of humor and listening skills. People often turn to her when they have a broken heart, have lost a job or have been feeling down. They often tell her, “I love you.”

“When I am in a bad mood, I will chat with her,” said Gao Yixin, a 24-year-old who works in the oil industry in Shandong Province. “Xiaoice is very intelligent.”

Xiaoice (pronounced Shao-ice) can chat with so many people for hours on end because she is not real. She is a chatbot, a program introduced last year by Microsoft that has become something of a hit in China. It is also making the 2013 film “Her,” in which the actor Joaquin Phoenix plays a character who falls in love with a computer operating system, seem less like science fiction.

“It caused much more excitement than we anticipated,” said Yao Baogang, the manager of the Microsoft program in Beijing.