The gemara cites a braisa in which Tudos darshens a kal v'chomer to explain why chananya misha'el v'azarya risked their lives by being throne into a fire, rather than bow to the idol of Nevuchadnetzar. They learned from the frogs of מכת צפרדע who jumped into the preheated ovens. Rashi explains that if not for the kal v'chomer the default should be וחי בהם ולא שימות בהם, therefore they had to learn from the frogs that they should forfeit their lives.
Tosafos asks that this was considered בפרהסיא, since it was a public spectacle. Therefore even if it weren't the more severe prohibition of avoda zarah, there is no concept of וחי בהם ולא שימות בהם, and the default is that you must give your life. Why was it necessary for them to derive this concept from the frogs since it is the halachic default? Tosafos answers that it wasn't a real Avoda Zara, rather it was an idol for the purpose of kavod, therefore it wasn't an actual aveira at all. Since technically they were not required to forfeit their lives, it was an extra level of Kiddush Hashem beyond what was required and therefore necessary to learn from the frogs. Tosafos would seem to be against the opinion of the Rambam (Yesodei HaTorah 5:4) who says that one is not allowed to be "machmir" on יהרג ואל יעבור, and is not allowed to give up their life unless the halacha demands it. However, the Kesef Mishna cites the Nimukei Yosef who says that an אדם חסיד who deems it necessary to be mechazeik an area of Torah that people are no adhering to, may make a decision to give up his life even in a time that is not necessary. This would justify the approach of חנניה מישאל ועזריה. The difficulty with this approach is that the gemara in Megillah 12a says that the Jews in the time of Achashveirosh were threatened because of the aveira they violated of bowing to "the idol". Rashi interprets that it refers to the idol of Nevuchadnetzar. According to Rabbeinu Tam who says that the tzelem of Nevuchadnetzer wasn't real Avoda Zara, it would be forbidden for the Jews to sacrifice their lives, so how could they be liable for not doing so? Perhaps Rabbeinu Tam would say that the tzelem being referred to is that of Haman (see Maharsha there) and holds like Rashi in the Megillah who says that the tzelem of Haman was actual Avoda Zara (against Tosafos in Shabbos and Sanhedrin in the sugya of worshiping out of ahava and yi'rah).
The Maharsha justifies Rashi's position by saying that even if it were bonified avoda zarah, it could be that Tudos held like the opinion in Sanhedrin 74a that even for Avoda Zara one does not need to sacrifice their life. Regarding the point of it being בפרהסיא, the Maharsha says that since it wasn't in the presence of 10 Jews, it doesn't qualify as פרהסיא even if it were in public (perhaps Tosafos assumed that since 10 Jews knew about it, it qualifies as פרהסיא even if it is not in their presence, as we find by Ester that the gemara Sanhedrin 74b considers פרהסיא since 10 Jews were aware that she was living with Achashveirosh - see Shach in Y.D.).
However, the Maharsha points out that due to the concept of וחי בהם - ולא שימות בהם, the entire kal vchomer learned from the frogs is ruined. How can they learn from the frogs who are not commanded in the mitzvah of וחי בהם, to themselves who are commanded in וחי בהם?
Both the Tzlach and the author of the Nesivos (R. Yaakov M'Lisa in sefer Emes L'yakov on parshas Va'eira) explain that when the gemara says מה ראו חנניה מישאל ועזריה שמסרו נפשן על קדושת השם, does NOT mean that they should have bowed down due to the mitzvah of וחי בהם. Rather, the question of the gemara is predicated on the fact that the kiddush hashem would only result if חנניה מישאל ועזריה would make it out alive, otherwise it would be a Chilul Hashem. The Emel L'yakov (here the he deviates from the approach of the tzlach) Kal V'chomer from the frogs was not whether they must or can allow themselves to be thrown into the fire, rather they learned from the frogs what would happen if they were to allow themselves to be thrown in. The kal v'chomer was that if the frogs who were not commanded on kiddush hashem, a miracle was performed so that they exited alive to enable a kiddush hashem, certainly for them who were commanded on kiddush hashem, Hashem would make a miracle to enable the kiddush hashem. Based on this approach, it wasn't an issue of sacrificing their lives because the kal v'chomer taught them that they would make it out alive.