Free and legal usually means one of three things: the work is in the public domain, the author released it under an open licence, or a library or archive has permission to distribute it. All three are safe to download and read.
New commercial releases are rarely free legally. If a site offers a recent bestseller as a direct download with no library, no licence, and no author permission, the file is almost certainly unauthorised. Use official library apps such as Libby or OverDrive, or buy the ebook.
Availability can vary by country.
Copyright terms differ by country. Verify that a work is public domain where you live, and use official library apps for modern titles.