To reinvent the wheel is to duplicate a basic method that has already previously been created or optimized by others. It is commonly used in software development and other engineering disciplines.
The inspiration for this idiomatic metaphor lies in the fact that the wheel is the archetype of human ingenuity, both by virtue of the added power and flexibility it affords its users, and also in the ancient origins which allow it to underlie much, if not all, of modern technology. As it has already been invented, and is not considered to have any operational flaws, an attempt to reinvent it would be pointless and add no value to the object, and would be a waste of time, diverting the investigator's resources from possibly more worthy goals which his skills could advance more substantially.
At the same time "reinventing the wheel" is an important tool in the instruction of complex ideas. Rather than providing students simply with a list of known facts and techniques and expecting them to incorporate these ideas perfectly and rapidly, the instructor instead will build up the material anew, leaving the student to work out those key steps which embody the reasoning characteristic of the field.
"Reinventing the wheel" may be an ironic cliche - it is not clear when the wheel itself was actually invented. The modern "invention" of the wheel might actually be a "re-invention" of an age-old invention. Additionally, many different wheels featuring enhancements on existing wheels (such as the many types of available tires) are regularly developed and marketed. The metaphor emphasizes understanding existing solutions, but not necessarily settling for them.
Reinventing the square wheel is the practice of unnecessarily engineering artifacts that provide functionality already provided...