Well obviously individuals with larger sex drives want to have sex more meaning they are more likely to pass on their genes, and as such humans have evolved in a way that causes us to want to fuck all the time.
Fapping merely stems from having these desires unfilled, not as an actual evolutionary advantage itself.