In the early 19th century, calling something 'the cheese' meant that it was the right thing and of first-rate quality. By the end of the century, basically by way of student slang, 'cheesy' had taken on the exact opposite meaning...namely, something second-rate, cheap and nasty.
It really has nothing to do with 'cheese' but probably rather to do with the Urdu word 'chiz', meaning 'thing' in the original sense of 'the real thing', as in the opening sentence above. Many such words were brought back from India by soldiers serving there during the days of the British Raj.