Answer: Racecourses offer races to be sponsored by companies or individuals who wish to advertise. For example in 2019 Randox Health sponsored the Grand National which was thus named the Randox Health 2019 Grand National. They have the contract for five years.
To sponsor such a race would cost several thousand pounds however a small race at the Wolverhampton all-weather course for example would set you back just £500.
Some big companies will sponsor every race on the card for example Badgers Ales at Wincanton. One of their annual races is THE BADGER ALES TROPHY HANDICAP STEEPLE CHASE.
Sometimes a racecourse will name a race after a horse that has performed well at their course. For example Exeter has the Best Mate Beginners Chase, named after the triple Cheltenham Gold Cup winner Best Mate, owned by Jim Lewis and trained by Henrietta Knight.
Best Mate was a frequent winner of Exeter's William Hill Haldon Gold Cup Chase. But sadly died while competing in that race in 2005.