I know this question sounds dumb, but please bear with me. This question came into my mind while I was looking at the photos in an astronomy book. How is it possible that IR and UV photos of stars and nebulae are taken if our eyes could not detect them?
The images are taken by UV/IR cameras. But the frequencies are mapped down/up to visible region using some scheme. If you want to preserve the ratios of frequencies you do a linear scaling. Generally the scaling is done in way to strike balance between aesthetics and informativity.
In light of the overwhelming attention to this question, I have decided to add the recent image of a black hole as taken by the Event Horizon Telescope. This image was captured in radio waves by array of radio telescopes in eight different places on earth. And the data was combined and represented in the following way.
A point that I forgot to mention which was pointed out by @thegreatemu in the comments below is that the black hole image data was all collected at just one radio wavelength (of $1.3$mm). The colour in this image signifies the intensity of the radio wave. Brighter implying brighter signal.
when you are looking at a UV or IR photo, the intensities of these (invisible) rays are represented by different (visible) colors and brightnesses in the photo. This technique of rendering things our eyes cannot see into images that we can see is common, and the images thus prepared are called false color images.
Because you can build a camera that can.
The sensitivity of a camera is not determined by human eyes, but by the construction of the camera's sensor. Given that in most common applications we want the camera to capture something that mimics what our eyes see, we generally build them to likewise be sensitive to approximately the same frequencies of light that our eyes are sensitive to.
However, there's nothing to prevent you from building a camera that is sensitive to a different frequency spectrum, and so we do. Not only ultraviolet, but infrared, X-rays, and more are all possible targets.
If you're asking why the pictures are visible, well that's because we need to see them with our eyes, so we paint them using visible pigments or display them on displays that emit visible light. However, this doesn't make the pictures "wrong" - at the basic level, both visible light and UV/IR pictures taken by modern cameras are the same thing: long strings of binary bits, not "colors". They take interpretation to make them useful to us.
Typically, UV/IR cameras take greyscale images, because there are no sensible "colors" to assign the different frequencies - or better, "color" is just a made up thing that comes from our brains, and is not a property of light. So coloring all "invisible" lights grey is not "wrong" any more than anything else - and it's easier to build the sensors (which means "cheaper"), because the way you make a color-discriminating camera is effectively the same as the way your eyes are made: you have sub-pixelar elements that are sensitive to different frequency ranges.
Think of shining an intense infrared beam onto wood. The wood is scorched. You can see the scorching with visible light, even though the infrared beam is not visible. Do it again, but put some metal in the way to block part of the beam. Now you can see the shadow of the metal.
This is much like how Xrays film shows bones.
Camera are the similar. When sensors in the camera are stimulated by UV/IR/Xrays, they produce an electrical signal. These signals are stored as pixels in an image. You can display the image on a monitor, and choose to make the pixels be whatever color you like.
Imagine writing a program that listens to sounds through your computer's microphone and paints the screen a different color for every different note (or frequency). Suddenly you can point it at somebody singing and "see" the sound. You can even show it to a deaf person, and they can have an idea of what kind of song they're watching through the colors they see. None of their senses can capture sound, yet they're seeing it on the screen, because the thing that's capturing the sound is the microphone.
An UV camera is pretty much the same. A sensor captures some light that your eyes can't, and a program paints the screen a different color for every UV frequency you can't see.
A camera does not store light. The light you see when you look at a photo is not the same as the light that was captured when the photo was taken.
When light enters a digital camera it triggers electrical changes in the image sensor, which are converted to digital data by an ADC. In a film camera the light instead causes chemical changes in the film emulsion which are retained until the film is developed.
Humans are basically trichromats. We have three different types of "cones" in our eyes with different responses to light. So we can get away with representing color with three numbers per pixel in a digital imaging system or three layers in a chemical film.
Some time later, we reconstruct an image for a person to view. In a simplistic digital camera we would take the red, green and blue values for each pixel and use them to light the red green and blue pixels on our display. In reality there is usually some adjustment involved, because the filters in the camera don't precisely represent the human eye and because the frequency bands overlap, so it is not possible to find "primary colors" that trigger only one cone.
Regular digital cameras are designed to approximate our eyes, because that is what most people want. But there is no fundamental reason why cameras have to be that way. As long as we can build a lens to focus the rays and a sensor that will respond to them we can capture an image.
It's possible to build a camera to work with multiple wavebands at the same time, and this is how regular cameras work, but it's not a great choice for scientific imaging for a few reasons. Firstly the "bayer filter" has to be basically printed onto the sensor, meaning it can't be changed. Secondly it means that your pixels for different wavebands have slightly different spacial locations.
So for obscure wavebands a more common solution is to capture one waveband at a time, the images can then be combined into a single multi-channel image after capture. Or only one monochrome image may be captured, it all depends on the goal of the imaging.
Of course we humans can still only see visible light and we can only see that trichromatically, so at some point the creator of an image has to make a judgement call on how to map the scientific image data (which may have an arbitrary number of channels) to a RGB image (which has exactly 3 channels) for display. Note that color in the final image does not nessacerally imply that there were multiple channels in the original image data, it is not uncommon to use a mapping process that maps a single channel input to a color output.
Let's follow on with your logic. You're positing that nothing can happen that our bodies can't do. OK:
How can a car drive 200+ miles an hour if we can't run that fast?
How can a plane fly if we can't?
How can a submarine spend weeks underwater if we can't stay underwater (and alive :-) that long?
The answer is that the machines we build can do things that we cannot do without their aid. We build these machines to expand our capabilities.
Cameras are a machine which can do things, such as respond to radiation in the ultraviolet and infrared range of the spectrum, which our eyes cannot.
Answer to the question: How is it possible there are UV photos while our eyes cannot detect UV waves? We are so made, mainly by water, and water has "optical window" absoption coefficient, that means huge one at the ends of window(infra red and ultra violet) and low at green wavelength. So this is reason for our sensitivity for green.