You can get it sort-of easy depending on your lifestyle and immune system. Go to the gym, take a shower without flop-flops on, stuff your feet into shoes with synthetic socks and sit in an office chair for the next 10 hours.
AF is one type of fungus you can get, but there are others too not treatable with the OTC sprays and powders. So if you get it, and it won't go away, you may need to see a doctor. AF is just the most common type.
It can be anywhere, even in sand at the beach I've heard. But any shower environment for sure, at the gym, in dorms, campground showers. Or a hotel bathroom that didn't clean the tub properly before you checked in. Or a shower at a relatives house. Or if a relative/friend came to see you and used your shower. Do you know the status of all the feet in your life? LOL I got it after a visit by my inlaws. My own shower in my own house!!
After that... I started cleaning the tub and floor before any shower I took, anywhere that I was. Or wearing shoes if it was public. I used to have misconceptions of it, thought you just needed dirty feet to get it. After I got it I researched it further and learned all sorts of things about it.
My sister in law had it, and she brought it to me. She got it from either the dorm or the pool.
The trick with treatment (and prevention) that worked for me was the OTC spray, to treat use it twice a day for 30 days. I caught it super early, and clipped off as much as the affected nail that I could as it grew out, as well as file down what couldn't be clipped by using a nail file on the top of the nail. Took FOREVER for my nail to look normal again.
It started with insane itching and skin peeling on my pinky toes. It was sort of like what could happen in the winter with dry feet. But itchy. So I researched it then to see what the heck it was. If I hadn't, I might not have nails on my big toes now! It can get pretty serious if left untreated.
Another place to get it is nail salons when you get pedicures. They don't always follow sanitation rules. As a former salon professional, it's a lot more common than you think to avoid proper sanitation. Time is money, and it takes time to follow sanitation rules after every client. How many times have you gotten a manicure and they just pull the tools from a drawer, or use the drill that's just hanging up without changing the bit? And that little jar with the alcohol in it, that needs changed twice a day. Don't even get me started on clipper blades and combs for men's haircuts, or the brushes for finishing a blowdry on a lady.