There’s a famous reddit post of a guy peeing on a pregnancy test as a joke and posting the positive result. The comments informed him to see a doctor immediately and his follow up indicated the doctor found testicular cancer. Ever since then, any time I’ve seen male + pregnancy test posts, I’ve seen people commenting about its link to cancer.
It should be noted that a pregnancy test cannot detect all types of testicular cancer, and it should not be used to determine that you don't have cancer.
In other words, if it's positive, there's a decently high chance you have testicular cancer (though there are other reasons it could be positive), and, if it's negative, you don't know if you have cancer or not. A pregnancy test will not give you a definitive yes/ no answer.
A better at-home test for testicular cancer is literally just feeling your balls for any weird lumps about once a month or so. Testicular cancer generally shows up first as a painless lump. If you find such a lump, see a doctor for a diagnosis.