Ship classifications are based off size not because of some arbitary sci-fi or military history trope. Form follows function, and size is as much a part of form as anything else. The requirements of roles force ship design into certain size categories, and thus you can tell a ship's rough role and capabilities by its size.
-----
Mahan identified the fundamental theories that dictated naval combat in history. The gist of it was that splitting your navy up into smaller squadrons and spreading them about was dooming them to get gobbled up one by one in a repeated defeat-in-detail. Hence, the optimal strategy was to blob your entire navy up into one big doomstack, which would inevitably get thrown at your foe's doom blob in one big decisive battle. The loser of that battle would be out of ships, and since ships would require literal years to build replacements would emerge from the yards one at a time and get mobbed. The winner was free to do as he pleased, and has basically won the war at the point. To win the war, you thus had to win that battle at all costs.
The ship required for that battle thus required big guns and big defences, to brawl it out with best of the enemy navy and win; it also needed a large operational range, to make it to your opponent's home ports and ram your victory down their politician's throats once the navy was dealt with, and so needed large stores of provisions. These demands all converged to the same solution: build BIG. Take advantage of economies of scale to concentrate as much power as possible into a single location. Such a big ship demanded a big investment of resources and capital, hence the term Capital ship. In the age of sail this would be the ship-of-the-line, mounting 70-100+ guns on a large hull with maneuverability a secondary concern. While the first ironclads were based directly on frigate designs this was very much their intended role, and thus competitive pressures kept them growing bigger and bigger until they became the "line-of-battle-ship" AKA battleship of the WW1/WW2 period.
But Mahanian theory is also wrong, or to be more precise incomplete. Navies also have to protect marine trade and protect coastlines. Expecting capital ships to spread out and patrol this wide expanse of coastline is folly, and goes against their intended purpose. Instead another class of ships is needed. Cheap to make and operate, so that many can be bought to cover large areas; nimble and manuverable and possessed of enough speed to run down merchantmen (but no more, because speed is expensive); and needing little gun or protection, just enough to intimidate merchants into compliance and scare off pirates. Going small covered the needs while keeping cost to a minimum. It meant low operational range, but these patrol vessels didn't need to go far beyond coastal waters. These are your corvettes, sloops, cutters, brigs etc, the naval equivalent of a garrison force. Modern days see ocean-going patrol vessels of a few hundred tons, and anti-submarine and anti-air requirements for convoy escort bump up mass even further to produce what in WW2 were also called "frigates, "destroyer escorts", "kaibokan" etc depending on what service you belonged to, but the patrol role remains in its demand for small, cheap, wide-spread ships.
This also leaves open another niche to be fulfilled. Distrupting your foe's shipping is tempting, and overmatching the patrol ships is relatively easy with a modest increase in size which also allows you to load the provisions you need to get to your foe's waters and hit their merchants. At the same time, you don't want to go too big; you'll need a lot of these ships that will have to spread out and operate on their own to effectively hunt merchants, you need to outmaneuver the inevitable retaliatory capital ship doomblob (since it'll be operating on its own, trying to outfight them at a hefty numerical disadvantage will never work), and if the worst happens, operating far from support or reinforcements in the enemy's backyard, it'll be cheaper to replace. Also relevant are a variety of other roles, such as protecting your merchants or other secondary targets from your foe's own raiders, bulking up distant colonial garrisons on the cheap, or scouting and conducting harassment to support the main fleet; tasks that require something bigger than a small patrol ship but not rating the attention of the full battleline. Thus does design of these ships converge to a medium-sized vessel, larger and longer-ranged and more dangerous than patrol ships, but smaller and faster and cheaper than the capital ship. Frigates filled this role in the age of sail, and with steam power came their descendants in the cruisers. The battlecruiser is also part of this lineage, caused by cruiser-on-cruiser competition forcing them to grow bigger to outmatch each other.