There has already been a question on where to find the source code for pdfTeX. The answer is that it can be found on CTAN, in the systems directory. Update from 2023: on tug.org.
Unfortunately, the source code for XeTeX is not there. Where can I find the source code for XeTeX?
It would be interesting to provide links to the source codes of all major engines in the answer, to make it easier to access them.