Polymorph spell (PHB p.266)
This spell transforms a creature that you can see within range into a new form.
The target’s game statistics, including mental ability scores, are replaced by the statistics of the chosen beast.
RAW, there is no restriction on the beast form excepting the Challenge Rating allowed and the caster's ability to choose it. For a person to make a choice they need to know the choice exists and so that is all that this spell requires, the rest is handled by magic.
The important thing here is the difference between what the player knows and what the caster, the character, knows. It is the character that needs to know the about the beast form. The DM will be the final judge on what beasts the character knows about, particularly when a player pushes the limits of the spell, and they will.
For example: turning someone into a frog. This seems entirely reasonable (baring exceptional circumstances) as knowing about frogs is commonplace, even if you have never seen one (e.g. because the character comes from a desert setting that has no frogs). The frog is quite possibly an example of what the spell can achieve written in in "arcane manuals" or even the spell itself given the "turn him into a frog" trope.
However, as a second example, turning someone into an Ankylosaurus is going to take justification, in my opinion. Knowledge of the existence of dinosaurs, let alone specific dinosaurs, is quite possibly very rare, but again setting dependant. So while the player may have read the Monster Manual, the character has not and would have to have knowledge from some in-character source to be able to say "Siiiiiize of a Triceratops!" as part of their spell.
Do you need to know the creature to use Polymorph to change someone into that creature?
YES, the character needs to know about the creature to be able to choose it and it is down to the DM's judgement whether they do.
Of course the character casting the spell may know the beast form but may not have a good idea of the beast form's strength (the players will know this as its CR) compared to the target.
When it comes down to it this is a role-playing issue, where the player of the casting character has a responsibility to be reasonable and come armed with good in-character, good story, reasons to be able to use the beast form they want to use.