No, cranks are not generally always interchangeable, but you probably can transplant the crank from the broken bike.
First, do both bikes have 6, 7 or 8 sprockets in the rear cluster? If so, they use the same chain width and the spacing between the chainrings will be the same. Same deal if they both have 9 sprockets. (As you mention the chainrings are riveted to the crank I think you probably have a lower number of sprockets).
The cranks need to have the same chainline, but MTB triple cranks almost always used 47.5-50mm so they should be compatible in that regard.
Older or lower end 'three-piece' cranks use a bottom bracket that includes the axle and are threaded into the frame, the crank arms fit into a square or splined taper on the end of the axle. Newer 'two-piece' cranks incorporate the axle into the drive side crank and fit into bearing cups either threaded or pressed into the frame.
As you mention your crank has fixed chainrings it's certainly of the three-piece type. I assume the donor bike is the same. If you tried swapping the cranks only you may run into trouble with the axle interface being different. Also different model cranks generally require a different length axle to get the correct chainline, so the bottom bracket axles may be different lengths. You can get around this by swapping the crank and the bottom bracket together
The only other stumbling block is if the bottom bracket shells are different widths, On older MTBs 68 and 73mm wide shells were both used.
Check that the donor bottom bracket bearings are not worn out of course. Note that special tools are needed to pull the cranks off the axle tapers and to unthread the bottom bracket cartridge.
Here are a couple of Park Tool videos that include removing and installing 3 piece cranks and bottom brackets.
https://www.parktool.com/blog/repair-help/how-to-remove-and-install-a-crank
https://www.parktool.com/blog/repair-help/bottom-bracket-removal-installation-threaded