The species finds horns attractive
I will resist the obvious pun. This is one of my go-to answers for what is the advantage of the trait.
If a trait make a individual more attractive to a mate it will be selected for.
If you need a further justification. If large horns are a sign of getting more nutrition, finding horns attractive might be selected for in a species.
As to where the horns came from. It is basically a statistical impossiblity for horns to appear fully formed in a species. Much more possible is that all the closely related species had a common ancestor species that had horn and your "Humans" lost them (they are weird hornless humanionds). This would be over tens of thousands of years so "Humans" will never remember having horns.
See: https://rarediseases.info.nih.gov/diseases/614/alopecia-universalis for people with a mutation that means they have not hair at all.
The horns themselves evolved millions of years ago just like they did in our world.
Heck ... the other possiblity is all the humanoids are not closely related at all but a result of convergent evolutions (see https://en.wikipedia.org/wiki/Convergent_evolution). There is some evolutionary pressure, in this world, for intelligent tool users to become humanoid bipeds. In this case vastly different evolutionary lines (some with horns and some without) as they became intellegent tool-users would start to change into something that looked more and more humanoid.