Well, it all comes down to the Civil Rights act of 1964. Among other things, it prohibits discrimination on the basis of sex by service industries. In 2020, the Supreme Court decided that "sex" includes homosexual or transgender, in three separate cases:
Bostock v. Clayton County - Wikipedia
Altitude Express, Inc. v. Zarda - Wikipedia
R.G. & G.R. Harris Funeral Homes Inc. v. Equal Employment Opportunity Commission - Wikipedia
In the previous case with the baker, he refused to make a specialized wedding cake for a homosexual couple. Homosexual weddings weren't legal in Colorado at the time, so the baker had a possible case, and this was before the 2020 rulings. The Supreme Court didn't decide on the merits of the case; they threw out the case because the Colorado Civil Rights Commission had been openly hostile to the baker's religious views.
Now, the Supreme Court could conceivably throw out the precedent of the 2020 cases, but that's extremely unlikely. This court is rather fond of precedent, overall.