Why was Oscar Wilde publically shamed while he lived, but embraced and elevated to the status of a literary genius and cultural icon after his death?
To answer this question fairly, you may want to check out the books Oscar Wilde by Richard Ellman, Oscar Wilde: his Life and Confessions by Frank Harris, and/or Oscar Wilde by Robert Sherard.
These three are the only autobiographies which Wilde's only surviving grandson, Merlin Holland, actually cites when addressing the life and times of the grandfather that he never got to meet.
According to all three biographers, as Wilde never wrote an autobiography per se, Oscar Wilde was publicly shamed as the result of collected efforts to shut down his rising fame and notoriety. These efforts were sponsored primarily by Lord John Sholto Douglas, Marquess of Queensberry, whose son, Lord Alfred, was Wilde's love interest.
Wilde was not notorious for being gay. He was notorious for being gay AND for exposing the Victorian middle classes for what they were: hypocritical and sanctimonious bores who refused to catch up with the times and who criticized everything and anyone who attempted to change the status quo. As a man who acted and thought way ahead of his time, Wilde embraced diversity, loved sarcasm, and would have fit perfectly well in the 21st century. He would have been no different than any other celebrity who loves irony, accepts his bisexual nature, and goes about acting eccentrically. But Wilde did not live in the 21st century; he lived in the stuffy and uber-regulated times of Queen Victoria. His problem is, according to those very biographers, that Wilde simply belonged to another time and place.
After Lord Douglas collected all the evidence that he needed to prosecute Wilde under Section 11 of the Criminal Amendment Act of 1885 (which condemned homosexuality if sodomy was proven), Wilde was publicly shamed as a sodomite by the very hypocritical Victorians that he tried to mock. According to records from the St. James's Gazette, the Daily Telegraph, and all the public records of the time (you can find them all reproduced online), the three trials of Oscar Wilde were something totally new to the world of journalism. They seemed like scenes right out of a movie: for the first time news reporters became "papparazi", and for the first time the words "gross indecency" became household terms.
The Victorians ended up burying Wilde, rather than imprisoning him. He spent the last four years of his life dying slowly; two of them in jail doing hard labor, and the other two throughout Europe until his sad and lonely death in Dieppe, in 1900.
The reason behind the Wilde revival has a single name: Germany. While England was having a fit over Wilde being gay, France, Germany, Italy, and many other European countries really did not see what was the big deal. Germany, out of all of them, was already growing a Wildean following shortly after his imprisonment. In fact, it was in Germany where Wilde's works continued to be published and reprinted, which came as a huge relief to Wilde's best friend, Robert Ross. It was thanks to Robbie that Wilde's works became restored in the world of arts. It took nearly 50 years after Wilde's death for Academia to grant Wilde's works their worth, as they deserved then and deserve now.
Why the hype?Change is unwelcome and Wilde changed many paradigms of his time. He called himself a snob and yet mingled with all social classes. He questioned rules and mocked regulations. He was literally the epitome of "danger" in a time where everyone walked on eggshells. His problem was his uniqueness.