But Michael Feathers, author of the legacy code refactoring book Working Effectively with Legacy Code, defines that any code with no automated unit tests is a legacy code. A piece of code could be well written, follow coding guidelines, easy to understand, clean, loosely coupled, and very easy to extend, but if it doesn't have automated unit tests, it is a legacy code.
Usually, fixing bugs or adding new features to a legacy project is very difficult compared to doing the same to a greenfield project. In legacy code, either automated unit tests do not exist or very few tests are written; the code is not designed for testability.
Winston Churchill said, "We make a living by what we get, but we make a life by what we give."
We inherit legacy code from someone else, it could come from a very old project...