There is a well-known anecdote about Tom Lehrer, but it's best categorized as an apocryphal or satirical story, not a verified true incident.
The story you're referring to likely goes something like this:
However, there is no credible evidence that this ever truly happened. It appears to be...