The 30-year-old lost 7-6 (7-3) 4-6 6-1 in the second-round tie on his first appearance since an injury ended his Australian Open challenge in January.
Djokovic had further surgery on a persistent elbow injury in February.
“It felt like first match I ever played on the tour. Very weird. I completely lost rhythm,” said the Serb.
“I was grateful to be out on the court after surgery that quickly but at the same time I just didn’t feel good at all.”
“I was not even supposed to be here because of the surgery that was only five, six weeks ago. But I recovered very quickly, and I got myself ready.”
The defeat was just the fifth time in the past decade former world number one Djokovic has lost against a player outside the top 100 players in the world.
Daniel was victorious after two hours and 30 minutes, and benefitted from 61 unforced errors from Djokovic, who has won 12 Grand Slam singles titles.
“He obviously wasn’t in his top form,” Daniel said. “So I was able to take advantage of it.
“And even if I lost the second set, I still had faith I could pull something off in the third. I was able to stay pretty tough, so I’m pretty proud of that.
“I played the best set of the whole match and that was really good.”
Elsewhere, world number one Roger Federer booked his place in the third round with a 6-3 7-6 (8-6) victory over Argentina’s Federico Delbonis.
The match was carried over from Saturday after rain force play to end early with Federer one set up and the scores locked at 2-2 in the second.
Federer saved a set point in the second-set tie-break before easing through. (Courtesy BBC)