Those tunnels with rails are abandoned mineshafts, which generate naturally underground in Minecraft.
Inside, you'll find chests containing valuable loot, plenty of cobwebs, and occasionally hostile mobs. The cobwebs are a nuisance—get caught in one and you'll move painfully slowly until you break free, and the only way to clear them is with a sword. So explore carefully, grab the loot, and watch your back for enemies lurking in the dark.