I don't think they are, who says they're hated? And compared to what other subcultures? Car guys and motorcycle guys are much more hated outside their hobby. Doing burnouts, making their toys as loud and fast/dangerous as humanly possible, shutting down intersections for tiktok videos, treating public roadways as racetracks, and just generally asshole behavior. Gamers aka incels? Sneakerheads? Sk8rbois? Wine snobs? Does anyone like wine snobs? Speaker guys? Audiophiles are universally mocked for being simultaneously arrogant and gullible. Gun nuts, need I elaborate on that? Potheads? Crypto bros? AI/singularity types? Paleo dorks? Crossfitters? Meme stock traders? A lot of these groups are widely seen as barely above pedophiles and you think the guys who take pictures of trains have a public image problem?
I can think of few subcultures that are hated less than train enthusiasts, in fact. Maybe not the most masculine or heroic public image but I don't think it's a negative one per se. Urbanists pretend to have some overlap with train foamers and no one likes urbanists, but you can tell it's a surface level appreciation of trains. They like trains because they believe trains are somehow anti-car or anti-boomer not because they genuinely appreciate trains. And so I don't think they're generally lumped into the same bucket.