@Anthonydyer Hidden traits are heritable (I think normally there's a 50% chance of passing one on) and are the result of a parent's career history or other life circumstances. For example, children of a sim in the military may have the "can salute" trait, firefighters can pass on "pyromaniac" and/or "immune to fire" traits (the latter at least is only imparted after around level 8 of the career), burglars' children can inherit the ability to sneak, rock stars can pass on "rocker," and so on. Additionally, NPC maids have the "makes no messes" trait, and pizza deliverers supposedly have some "pizza appreciation" trait granting a bonus moodlet when they eat pizza, although I've never seen that one.
There are a number of other hidden traits, like some related to occult life states. Sims from a particular WA world all have a hidden culture trait from that world. Some genie wishes can also be inherited; someone posted a couple of months ago wondering why a child sim's life stage was doubled in size, and it was because a parent had wished for long life.
If you're curious, nraas MC will list hidden traits along with visible ones. Click on the sim, nraas>MC>advanced>traits>change and you will see a list of all the possible traits in the game; hidden traits will have an "H" next to them, and there will be a "has" next to each trait that particular sim has. I suppose you could assign hidden traits this way as well... although there's a "DO NOT TRANSLATE" warning next to a few of them, so handle with care.