Where does the term "Say Cheese" come from when taking portrait pictures?
I can understand instructing people to smile, but why "Cheese"?
In France they don't say "cheese", but rather "ouistiti", which is the French for a kind of monkey I believe. These prompts are simply a way to get people's mouths into a "smiling position". How "cheese" or any other word was specifically arrived upon is probably lost to history.
Wikipedia has an article listing the equivalent of "say cheese" in different cultures.
People like their portrait when they are depicted smiling. Uttering words with the long ‘e’ sound does the trick. Watch the birdie and booby and cheese forces us to show our teeth with a smile.
I believe the use of "cheese" in the phrase is because of the position it puts the subject's mouth in. Mouth the word "cheese" slowly and you will notice that the ending "e" or "uh" sound puts the corners of your mouth in a smile.
Other answers here have focused on the why, so I have endeavoured to find a literal answer to the titular question where. According to the OED, the earliest mention of the practice is in Notes & Queries n:o 158 (Series 13, volume 2), which was published in the '30s. Unfortunately, that volume still has a few years before it is released into the public domain, but here is the passage as quoted in the OED:
Another slang use of the word ‘cheese’ was in vogue at Rugby School (…) This was with the meaning ‘smile’ both verb and noun.
As you can see, the term is spoken of in reminiscence, which would suggest it is older than the '30s, but not older than by a generation.
In slovak, they use the word Syr which stands for cheese but pronounced Seer (the word standing for the same concept of cheese is only a coincidence as far as this answer is concerned). As @WilliamAnderson points out in his answer - it's to get the subject(s) to express something of a smile while saying the word.