What's the point of knowledge ability checks if a PC can just know whatever the player wants it to?
I'll try again.
When the player just decides their character "knows" something, all that means is that the character
believes it. That's the case even if it's something the player him/herself also believes is true, such as trolls being vulnerable to fire, or Valindra Darkmantle being a lich. There is no guarantee this belief is true in the game world.
The only way to find out if your hypothesis is true is narrating a goal and approach. For example, "I'll hit the troll with my torch to see if fire keeps it from regenerating." That might require an attack roll, or the DM might even just give you an autosuccess (if, for example, the troll is paralyzed and there are no other enemies about.). You roll the dice, and the DM narrates the results. You, the player, might be very firmly convinced fire is going to work, because you've been playing D&D for 40 years and you know the DM doesn't often change up monster stats. But until the DM confirms that fire did the trick, it's just an hypothesis.
Another example might be, "I'll try to recall if I learned anything about trolls when I was a wee lad on the farm, sitting up at night listening to stories from the fugitive who told us all about Valinda Darkmantle." Again, the DM might just give you an autosuccess, tell you that you never heard any stories about trolls....or ask you for an ability check involving a skill. You roll the dice, and the DM narrates the results.
Got it?