Some AP tests are kept on the Collegeboard site such that you must be a teacher (with some login info) to access those tests. Teachers often use these for ‘mock AP tests’ or final exams because pretty much all of them are hard for students to get at. In this case, a student online was given the test by his/her teacher (bad practice) and chose to post it somewhere else.
So, yes, the OP got the test illegitimately. However, I give OP a little benefit of the doubt. If he/she had no idea the final exam would be from an old AP exam and simply googled ‘AP Biology practice exams’, only for this source on Reddit to come up, and then he/she looked at that test, it doesn’t seem too much like cheating – because of OP’s ignorance more than anything. The teacher should have made clear what they should or shouldn’t be using for practice if she/he didn’t want students to google practice questions, the kid on Reddit shouldn’t have shared the test. Should’ve, would’ve, could’ve.
Try to explain your situation, OP, and see what the teacher says.