My questions are these:
1. How does an X-ray machine work? (the answer is in the uni library)
Pretty simple. A X-Ray tube is just like a very first vacuum diode: a vacuum tube with a filament that acts as a hot cathode and a large anode. The anode is usually quite large and water-cooled. High voltage (20-100 kV typ.) is applied across this tube. At the place the cathode electron beam hits the anode, X-Ray appears.
Basically any HV vacuum rectifier produces X-Ray. The only difference is the shape of the anode that helps to direct the beam in a certain direction. Another difference is power - an x-ray tube is about 1 kW (that's why it's water cooled). To make a sharp image, a "point" x-ray source is needed. Many medical tubes have such an anode.
The registration is quite simple too. Just a cardboard with some fluorescent paint. The fluorescence is viewed using a camera or photographed.
2. Can I build my own machine or adapt something that already exists? What size would this machine be approximately?
Yes, for sure. The hardest part is x-ray protection. Thick metal (lead or similar) screens, leaded glass or rubber and so on. It is wise to place the machine in a separate room and control it remotely.
The size of the machine depends on this protection and on the power supply. You'll need about 1 kW at 40 kV. Older machines had a HUGE oil tank with a transformer inside, 400 pounds or so. Imagine a big pole transformer. Modern machines use switching power supply that fits in 19'' rack, maybe 2U or 3U size.
The X-ray tube itself is a cylinder of about 2 inches in diameter and 8 to 10 inches long, with high voltage connector at one end and water fittings at another. It is to be completely enclosed in a protective screen.
3. What constraints are there in an x-ray machine that inspects chips? For example, is it possible to damage the chip if the machine is too strong?
It is hard to damage the chip. It is more likely that you just won't see anything. If the machine is too strong, the chip will appear completely transparent. It is more likely that you'll get a blurred image. Since there is no such thing as X-ray optics, you have to rely on a small point x-ray source to get a sharp shadow on the fluorescent screen. Not all tubes are sharp enough. There are tubes that produce a wide beam, typically used for XRD or cancer treatment. It is hardly possible to see individual BGA pins using such a tube.
4. If I somehow either buy or build this machine, is there any restriction as to where it can and cannot be kept? If, for example, I keep it at an industrial unit, to what extent would I be endangering people around me? (these are probably naive questions, but I don't know the answers, and it's better to ask)
The rules differ from country to country. Basically an X-ray machine should have some kind of safety certificate. In some cases the whole room has to be certified, not the machine alone.
X-ray propagates like a visible light, so it is possible to have a narrow beam going through a gap in the protective screen. This is hard to find but this is very dangerous. It is even possible to be burnt with an x-ray beam, this looks like a solar burn on a spot of the skin. Lower dozes of radiation are cancerogenic.
Schematics of older machines would be very useful (obviously if there is no NDA involved).
I'll draw one
BUt it is very simple. Imagine a high voltage power source (maybe just a transformer, no matter if it is AC or DC) connected to a big diode valve (x-ray tube). That's all. Everything else is just a video camera, safety interlocks, water pump for cooling (if any), stepper motors for sample movement and so on.