Google pays Apple a lot of money to be their search engine. Presumably, if they became a competitor, Google would stop the $15 billion payments and Apple might want to make that up.
If there is an opportunity to increase revenue (subject to mission/values/etc), you take it. A decrease in another line of business doesn’t matter. Or an increase; you wouldn’t say “hey we’ve got this amazing ad opportunity but the AirPods business is killing it so let’s not bother.”
I guess the nuance here is that the business decision might be “our search, with our ads” versus “Google’s search, with their ads, plus $15B/year”. In that case I think there’s a reasonable argument that users are better off with Apple’s ads than Google’s.
It could also just be sold as a service, or an addition to iCloud+.