There are two main reasons for this. Firstly, different types of ship are capable of doing different things. A battleship makes a very poor landing ship, but you'd never want to have a Landing Ship Tank (LST) fighting in a naval battle. The same holds true even within a general classification of ship. An aircraft carrier is any ship with the primary role of carrying aircraft, and as such includes the large fleet carriers of the Essex or Yorktown classes, and the Bogue class escort carriers. A large carrier like an Essex is too expensive and slow to build to build in large numbers; as such, to fulfil the convoy escort role, the USN needed to build a smaller class of carrier, the Bogues.
The other main reason comes down to how ships are designed and constructed. A rifle, tank or artillery piece might be built in a few days to a few weeks, in a factory building hundreds, thousands, millions of the same model. Those pieces of equipment would only be expected to last for a few years before being replaced. A ship took months to years to produce. Shipyards typically built only a few ships at any one time, with only a few ships in a class, and they would be expected to last for years before replacement. This last factor accounts for some of the variety in ship classes - the oldest major warship in the USN during the war had been laid down in 1910. Military equipment was built in an assembly line fashion, ships were built in a more bespoke way. All this meant that design priorities were different. With military equipment, maximising the volume was important; this meant that it was harder to integrate the lessons of combat experience, as this would require the assembly line to be retooled. With ships, which were not built in such volume, lessons of combat or new design concepts could be integrated, and new classes constructed.
Just for clarification, you mean why the variety of ship's boats, yard lighters, and other small craft like the Captain's Gig, Whaleboats, and other small motor launches and support ships? Vs the actual ships like the frigates, corvettes, destroyers, cruisers, carriers, and battleships which did come in a score of varieties all their own.