BEIJING—China on Tuesday stood by its ally Pakistan amid growing questions in the U.S. about whether the country was complicit in harboring Osama bin Laden, the al Qaeda leader killed in a sprawling mansion in a garrison city close to Islamabad.

Meanwhile, an outpouring of discussion on the Chinese Internet revealed mixed views of bin Laden. Many users said the world was safer following his killing while others—including some prominent social and political commentators—expressed sympathy, and even respect, for the mastermind...