Toy makers that have fretted over whether their products could injure children have a new worry: Do toys make kids targets for hackers?

VTech Holdings Ltd., a Hong Kong maker of digital-learning toys and cordless phones, said Monday that an “unauthorized party” had accessed five million customer accounts, including users’ names, birthdays and passwords, some of them for children. The company said no Social Security or credit-card information was accessed.

VTech...