Well, I dont know either, I've practiced kundalini yoga for a long time, and read about the subject also, in many of the lineages there are stories of the original founder of some of the different types of yogas have received the information directly as some sort of "downloads", like from a higher place of existence or being, not just through trial and error.
There is also the story of Shiva being the first yogi, which one telling can be read here: https://isha.sadhguru.org/yoga/history-of-yoga/the-first-yog... .. you know, but these are of course stories, who knows how they originated.
Still, the yogis and holy men in India were considered to be like scientists today, studying the technology of the human beings, so these stories and things passed on are not just random findings but careful studying of the inner technologies on how we operate as humans.