You probably have an empty instance in your settings (eg. lemmy.ml but with no account under it) and were browsing the "Everything / All" feed, you went inside a post served "via lemmy.ml" and tried to upvote. Obviously it asks you to login in that case.
You can remove instances with no accounts by long pressing them. Also you can hide the everything feed from settings ;)
From the community main page you tap the three dots top right of the screen and choose "block community".