Answer:
The tenth doctor regenerated because he absorbed all the radiation from a radiation chamber to save Wilf's (Donna Noble's grandfather's) life. Wilf knocked four times, so the Doctor knew it was time for him to die (because in effect the tenth doctor dies and the eleventh doctor is born).
Episode: The End of Time (part 2)