** "Code Smell is a term used by agile programmers."** - wikipedia
In computer programming, a code smell may refer to anything unusual in the source code of a program that probably indicates a deeper problem. The term was popularised by Kent Beck on WardsWiki in the late 1990s. Duplicate code, too many comments or long classes can be considered as a code smell however exact definition is subjective & varies by language, developer, and community. And yes, we are not talking about a literal smell which is obvious! Consider expert programmers having this hypothetical nose in their brain such that, once they see code that indicates the violation of fundamental design principles and negatively impacts design quality, seeks to take proper action based on their gut feeling that something might be wrong! The code may not be technically incorrect and does not prevent the program from running instead it may include weaknesses that may slow down the development process or increase the risks of bugs and failures in the future. In a nutshell, a code smell is a metaphorical smell and not necessarily bugs!
According to Martin Fowler, in his book Refactoring: Improving the Design of Existing Code, popularized the term code smell quite a bit that it certainly gained traction in the agile community in particular. Bad code smells can be an indicator of factors that contribute to technical debt. Robert C. Martin (popularly known as Uncle Bob) calls a list of code smells a "value system" for software craftsmanship. Now, avoidance of bad code smells lead to elegant design principles. That is where code refactoring comes in & it is done to remove code smells where it is refactored into small, controlled steps, and the resulting design is examined for further code smells that in turn indicates the need for more refactoring.