How does union joint with two male threaded ends work? Does one male end rotate 360 degrees around it axis? How is the inside of the union constructed? Can I connect two pipes with female threads using a union joint and assemble/disassemble it without too much pain? Specifically, I am looking at a stainless steel union joint.
Typically, most threads on pipes (in the USA at least) are male NPT and all the couplings or fittings are female NPT.
A union is used for easy removal of pumps and other serviceable equipment that would otherwise not be easily unthreaded. It is also used to attach pipes in which neither pipe can not be rotated about its axis (perhaps because it is assembled to other plumbing, etc). The following image is the best section view of a union I could find. Most of the ones I have used have a flat steel face that mates to a flat steel face with an oring (with no 45 degree bevel like shown in the image). The flat faces allow the equipment to easily be removed sideways out of the plumbing when the union is detached.
Most hardware/plumbing stores sell pipe unions and will let you take them apart to see if they fit your needs. Seeing them first hand is the best way to get a feel for how they work.