smoke from a failed microwave can potentially contain beryllium oxide which is an extremely hazardous chemical to inhale and exposure may be insidious given it is odourless - however there does not appear to be any reported cases of toxicity from smoke from failed microwaves and the risk would depend on the extent of damage to the magnetron and the amount of beryllium oxide released and the extent of inhalational exposure
fortunately, most times a microwave fails with acrid smoke, the part at fault is a high voltage transformer, silicon rectifier used in the high voltage DC supply for the magnetron, or the high voltage capacitor or diode (if it is just a burnt smell without smoke and the controls do not light up, it may just be a blown fuse) rather than the magnetron (magnetron tubes are very reliable and not very likely to fail in less than 10-15 years), and this smoke is generally from the wiring insulation which is much less hazardous (assuming you don't stay in the room full of smoke) but has an acrid odour
do not attempt to open or disassemble the magnetron, as this can release beryllium oxide dust or fumes
do not perform any actions that could generate dust, such as sanding, grinding, or cutting the magnetron or other components
if the microwave is severely damaged, wearing PPE, carefully seal it in a plastic bag or container to contain any potential contaminants.
get a professional to remove the microwave and dispose appropriately