According to Guinness World Records:
"Greatest number of descendants
At the time of his death on 15 October 1992, Samuel S. Mast (USA), aged 96, of Fryburg, Pennsylvania, had 824 living descendants. The roll call comprised 11 children, 97 grandchildren, 634 great-grandchildren and 82 great-great-grandchildren.
The last Sharifian Emperor of Morocco, Moulay Ismail (1672-1727), known as The Bloodthirsty, was reputed to have fathered a total of 525 sons and 342 daughters by 1703 and achieved a 700th son in 1721." -from https://en.wikipedia.org/wiki/Ismail_Ibn_Sharif#Legacy
Rulers with harems definitely had an advantage in this category, but they weren't always long-lived. Guinness requires documentation for its records, so historical candidates often fail in this requirement.