There are a few reasons at play here, which all played a part in some way, shape or form.
One, they didn’t want him to become a martyr or a symbol of French nationalism which could then lead to other upstarts, public revolt and potential ‘revenge wars’ down the track.
Secondly, Napoleon came to power after the previous French monarch was killed. To execute him could have set a dangerous precedent across Europe that heads of state weren’t ‘untouchable’, for lack of a better word. Basically, executing a monarch/head of state back then was still quite taboo, regardless of whether they’re your enemy or not.
Third, this was still a time of honour and chivalry. Napoleon surrendered himself, and the British/other Nations were somewhat honour bound not to kill a prisoner who surrendered by their own accord. Also, showing leniency would encourage other enemies in the future to surrender too.
Hope this helps.