If it's the underside of a caboose, they had a generator and belt running off an axle. But I would have expected it to be mounted on the sideframes of a truck or bogie.
That's my guess, but it doesn't look like a generator. Maybe some sort of odometer? Sorry.