Why does it happen that when I take a picture of some product or person, only one portion is sharp and the rest gets hazy. I was facing this problem unless it was a top product shot or when everything was at the same distance." - this is a typical question asked by students or starters trying their hands at product photography.
This could be dues to a number of reasons. Most importantly the depth of field which depends upon the aperture, focal length and the distance. If the products are very close to the camera, the lower distance is going to work against the depth of field, which means that the part of the product may go out of focus or in other words the whole product is not covered by the depth of field. Remember, you can focus only at one particular distance and not more than one.
Now if the product is not equidistant from the camera like a curved pot or cylinder. The front protruding part is where one focuses and if the aperture is not closed down enough and the distance is very less, the edges will blur out and wont be as sharp as where the product was focused.
However, when you shoot a curved or cylindrical product from top, its surface is more or less equidistant from the camera and thus almost everything appears sharp, because you are seeing only one surface in the frame.
So in nutshell for product photography, close down the aperture for enough depth of field, Don't use too long a focal length but this you may not always be able to control. But if possible go for moderate and not very long lenses. Do not go too close. Sometimes, you may crop the image a little bit instead of going in too close. This lets you achieve deeper depth of field due to an increase in distance.
Also, make sure that you have not gone too close to the subject. All lenses have a minimum focusing distance. If your subject is within this distance, the lens will not be able to focus, automatically or manually. In such situations, maybe you will get the front part of the product out of focus compared to the edges which are at a greater distance.
Likewise when shooting people, the features are not at one plane. If you are shooting a tight frame, chances are some features may go out of focus as which shooting at wide open apertures like f 1,4 with the subject to camera distance being very less. Less distance means shallow depth of field. And if this lens is of longer focal length, that will further reduce the depth of filed.
Photographers should be able to use their limitations to their advantage. Having a part of the photograph in focus helps stand out that portion well against the other area but this may not work all the time. For example, in case of two people at different distances, you may not just throw one person out of focus and call it a "creative" photograph.