It looks like the first plane that actually flew and had at least a partially-retractable undercarriage was a German racing plane, the Wiencziers Renneindecker, from 1911:
You can see the undercarriage designed to collapse to the rear, using a hand crank in the cockpit to lift the gear. Not a great idea by today's standards as the gear would be prone to collapse on landing, but it apparently worked well enough at the time.
There are plans for retractable landing gear dating back to the late 1800s, before powered flight in such a craft was ever achieved, but they didn't become common on planes until just after WWI. Even then, for relatively slow planes (<200mph) it remains common even today to keep the gear fixed and wrap the wheels in a cowl, as for only a ~4% increase in drag over a full retractable setup, you save a lot of weight and mechanical complexity. Notable fixed-gear craft in military service through WWII include the German Ju87 Stuka and the Nakajima Ki-27 "Nate". Though most of the American wartime air fleet had retractable gear as of just after the start of WWII, practically every WWII air corps draftee trained on either a BT-11 or one of the biplane trainers like the PT-13/17/18. Today, plenty of civvie small craft have fixed gear, such as the Cessna 150, 172 and variants, Piper Cubs and Cherokees, some Beechcraft Musketeers, etc etc.