Google determines what language your page is in by reading the words on the page like a person. It doesn't look at anything behind the scenes, like the URL or lang
attributes. That's why they recommend using one language per page (so no side-by-side translations).
If you have the same content in different languages on your site, just add hyperlinks to the other language versions and let the user pick their preferred language. When you do that, use a different URL and hreflang annotations for each language version.