For eight years, Trump bugged (annoyed) Obama with questions about his birth certificate. Later, Trump claimed that Obama bugged (wiretapped) him.
Merriam-Webster offers this "legal" definition of "bug," but gives no etymology:
to plant a concealed microphone in — compare eavesdrop, wiretap
It's been used this way as both a verb and a noun:
Trump wiretapping claim: Did Obama bug his successor?
The reason the Administration insisted on "secure and controlled conditions" for reconstruction was because the bugs were planted into the walls of the embassy by Soviet Government construction workers.
A search on etymonline for "bug" says the use in the sense of "wiretapping" dates to 1919, but I can't find a reference to exactly how or why the meaning originated.
Given how frequently the topic of "wiretapping" has been in the news in the U.S., how did wiretapping come to be called "bugging?"