It's mostly a relic of the industrial era. They didn't have MOS like systems back then, but the Navy obviously had very different organizational issues than the Army. An artilleryman in the Army knew he was an artilleryman because he was in an artillery uit. In the Navy, you'd have been assigned to a ship or installation where that clear distinction of Squad/Platoon/Company/Battalion/etc aren't there. So, the Navy had occupational rates that clarified a sailor's duties. Many have been deprecated and combined over the years, but they can be found here if you're interested in the variety and history. Someone with more knowledge than me might be able to explain better, but that's a pretty simple summary.