You're referring to William Hung's audition on Season 3 (2004). He sang Ricky Martin's "She Bangs" with enthusiastic, off-key confidence.
The judges (Simon Cowell, Paula Abdul, Randy Jackson) didn't literally hide under the table, but they put their heads down on the desk in disbelief/embarrassment, creating the iconic viral moment.
Hung's "so bad it's good" performance launched a brief novelty career.