I'm going to answer a bit more generally than just BSE, as there are a number of different prion diseases, but they broadly originate in the same ways. There are 3 general types of prion disease: sporadic, variable, and genetic. Genetic is what it sounds like: there is some abnormality in the genetic code for normal prion protein that makes the protein more likely to spontaneously convert into a pathological form. Examples of this in humans include fatal familial insomnia, GSS, and some forms of CJD.
Variable prion diseases are one that are acquired from an outside source, most often from eating food with infectious material. Some people have traced BSE outbreaks to the practice of feeding cows scraps from other farmed animals that were unknowingly contaminated with prion disease, for example giving them feed made from both vegetative matter that the cows want to eat as well as leftover sheep remains to supplement their diet. Scrapie is a prion disease that naturally occurs in sheep and goats, so when the scrapie prions are fed to cows it has a low chance of causing BSE in the cow. While this feeding practice has been illegal for a number of years now, it is likely that BSE originated from a genetic disease in sheep that was passed to cows by human feeding practices. I will note that we are not 100% certain that this is the origin of BSE, but it is the leading hypotheses and most researchers believe it to be the case. It persists because those prion proteins the infected cows made are better at infecting cows than the previous scrapie prions were, and unfortunately BSE is now considered endemic in certain areas, such as Great Britian.
The third form of prion disease that I mentioned is sporadic. Simply put, we don't know where it comes from or why it develops. There are a number of things it could be, but we don't currently have definitive answers.