IIRC, KDE was created because Motif/CDE were proprietary, but QT was free and had an open-source license, but wasn't compatible with the GPL. There was an agreement with Troltech, the creators of QT that would make QT available under a BSD-style license if they didn't release a free/open-source version after a year.
GNOME was created because of license issues with QT not being compatible with the GPL, so GNOME used GTK which was created by the GIMP project because Motif wasn't free.
GNOME was created because of license issues with QT not being compatible with the GPL, so GNOME used GTK which was created by the GIMP project because Motif wasn't free.