As the name implies, the key window is the window of an active application that receives keyboard events and is the focus of user activity.
If you're using Window Maker, the title bar of the key window is highlighted in black.
Generally speaking, the main window is the standard window where the user is currently working. However, the main window is not always the key window.
Imagine a user editing a document. The main window is the window holding the document while the key window could be the Search & Replace panel the user just opened to search for a certain phrase.