Google maps uses gtfs, public transport companies publish that feeds. Osm does not store this data, only subsets were imported, mostly the physical stuff, stops, stations and sometimes lines.
For proper public transport routing you need a service where this feeds were imported or linked correctly, and they can combine it with osm data for alternatives.
I used this osm based app a long time ago, I don't know if it's still working: https://transportr.app/