These deviations from traditional theory are necessary if economists are to understand empirically how people make decisions about what to consume, how much to save, how hard to work, how much schooling to get, etc. Furthermore, if economists understand the biases that people exhibit that lower their objective happiness, they can put on a bit of a presciptive, or normative, hat in either a policy or a general life advice sense.
Technically speaking, behavioral economics was first acknowledged by Adam Smith back in the eighteenth century, when he noted that human psychology is imperfect and that these imperfections could have an impact on economic decisions. This idea was mostly forgotten, however, until the Great Depression, when economists such as Irving Fisher and Vilfredo Pareto started thinking about the "human" factor in economic decision-making as a potential explanation for the stock market crash of 1929 and the events that transpired after.
Economist Herbert Simon officially took up the behavioral economics cause in 1955 when he coined the term "bounded rationality" as a way to acknowledge that humans don't possess infinite decision-making capabilities. Unfortunately, Simon's ideas weren't initially given a lot of attention (though Simon did win a Nobel Prize in 1978) until a couple of decades later.
Behavioral economics as a significant field of economic research is often thought to have started with the work of psychologists Daniel Kahneman and Amos Tversky. In 1979, Kahneman and Tversky published a paper entitled "Prospect Theory" that offers a framework for how people frame economic outcomes as gains and losses and how this framing affects people's economic decisions and choices. Prospect theory, or the idea that people dislike losses more than they like equivalent gains, is still one of the main pillars of behavioral economics, and it is consistent with a number of observed biases that traditional models of utility and risk aversion cannot explain.
Behavioral economics has come a long way since the initial work of Kahneman and Tversky- the first conference on behavioral economics was held at the University of Chicago in 1986, David Laibson became the first official behavioral economics professor in 1994, and the Quarterly Journal of Economics devoted an entire issue to behavioral economics in 1999. That said, behavioral economics is still a very new field, so there is a lot more left to learn.