Besides the answer by CDE and if you're looking for the canon answer, it is shown in Young Sheldon S02E10 A Stunted Childhood and a Can of Fancy Mixed Nuts that Sheldon comes across this word in a comic book store.
When he tries to develop a sense of humor, he goes to a comic book store which leads him to orchestrate practical where he sees this phrase
If it's funny, it's a Bazinga.
That's where Sheldon comes across this word. He uses this word when he plays jokes his family members.
Here is the official tweet.
From Cinemablend (emphasis mine),
That journey took him to a comic book store, where he purchased several practical jokes. He ended up playing many of them on his family. The practical jokes Sheldon bought were made by the Bazinga Novelty Company. The company's name undoubtedly plays a role, but that is not where the origin of "bazinga!" entirely lies.
The company's tagline holds the key. Bazinga Novelty Company's slogan was "If it's funny, it's a Bazinga!" and that is how Sheldon's catchphrase was born.