Former San Francisco quarterback Alex Smith completed 7-of-16 passes for 62 yards and guided the Chiefs to a pair of field goals, but the only offensive touchdown of the game came in the late going.
Daniels drove the 49ers 90 yards for the winning touchdown in a march that took 6:24 off the clock.
San Francisco starter Colin Kaepernick threw only two passes in the game.
After the 49ers' first field goal in the opening quarter, Quintin Demps returned the kickoff 104 yards for a touchdown.
Smith, who spent eight seasons with San Francisco, was traded to Kansas City after losing his job to Kaepernick. Smith completed 7-of-16 passes for 62 yards while playing all of the first half.
San Francisco improved to 1-1 in the pre-season. Kansas City is 0-2.