We will better understand the difference between the two phrases the Gemara quotes regarding everything being good: גם זו לטובה (this too is for the good) and כל דעביד רחמנא לטב עביד (all that Hashem does is for the good).
These two expressions are illustrated through stories in the Gemara. For example, Nochum Ish Gam Zu would always say 'this too is for the good,' even in the face of apparent misfortune. Rabbi Akiva, his student, would say 'all that Hashem does is for the good.' The difference lies in their approach: Nochum Ish Gam Zu saw the good in the event itself, while Rabbi Akiva recognized that the ultimate outcome would be good, even if it was not immediately apparent.
The stories of the king of Rome, the precious stones, and the various trials faced by the sages all demonstrate how what seems negative can turn out to be a hidden blessing. Through these stories, we learn to trust in Hashem's plan and to recognize that everything, even what appears to be bad, is ultimately for our benefit.