I suppose this probably happens because a digital camera lens has to capture the image and project it onto an area very much smaller than that of a 35mm film frame. A more demanding job for the lens' optics I'd think. It may also be affected by lens quality. The distortion can be corrected in a photo editing program. There are also various bits of software available that are dedicated to the job. Type 'photo lens distortion' into a search engine for information.
Correction nearly always means losing at least some of the photo and/or reshaping a little. How much this happens depends on the amount of distortion present in the original photo.
This is my attempt at correcting the photo done with Corel Photo-Paint 9. A program designed specifically for the job might have done better but probably not that much. I'm going to show the photos here because it better demonstrates what's been done if the steps can be viewed together. I think it will be OK to show things like this in the name of discussing problems (unless Admin thinks differently?) but keep the images to the usual size for the reasons given in the photo posting guide:
The original photo

The photo is put onto a background larger than the photo itself so that there was an area big enough to tug at the corners until the building is upright.

Finally, the photograph was cropped square.
