Near the end of the school day on Tuesday afternoon, a 10-year-old boy in Brooklyn stood along a bustling roadway waiting for a bus, most likely trying to get home.

But the police said the boy never made it onto the bus after he was struck by an S.U.V. driven by a man who had suffered a “medical episode,” causing him to lose control of the vehicle at an intersection in Midwood. The boy, whom the police identified as Enzo Farachio of Brooklyn, later died at a nearby hospital.

At around 2:43 p.m., the police said a man in his 50s was traveling north on Ocean Avenue, near Avenue L, in his gray Lexus S.U.V. when he veered off the road and mounted the sidewalk where Enzo was standing, the police said.

The driver, who was riding with his 9-year-old daughter, went on to strike a scaffolding on Ocean Avenue, the police said. The girl was taken to a nearby hospital for evaluation.