Huh... we don't seem to know the origin of the idea of mice loving to eat cheese? Tom and Jerry definitely popularized the idea, but it also doesn't seem to be the origin.
A common consensus seems to be that people back then loved to keep cheese out in the open, and then mice would come to eat the cheese because they're, well, out in the open.