Part 1/2
/u/kieslowskifan has written about eugenics and its history and how it intertwined with what became known as the T4-program and its aftermath before in this answer but as a quick recap, eugenics was a movement that embraced the idea that a population could be made genetically better by institution various measures, both what has been referred to as "positive" (improving care for newborns f.ex.) and "negative" (f.ex. sterilizing people with unwanted traits that were understood as hereditary at the time but aren't necessarily). It was as mentioned in the linked answer a rather heterogeneous movement that grew out of both the discovery of genetics as well as the demographic development of the 19th century were due to the industrial revolution and other phenomena, populations had first seen a sharp rise and then hit a plateau. It was the plateau that caused concern among politicians and others. In line with exclusionary class and social policies at the time and that caused fear that it was mainly the poor, uneducated, and people seen as "less worthy" were having more children than educated citizens.
In Germany, especially in völkisch circles – meaning the people who saw race as the driving factor of history – it became very popular to talk about instituting measures that would lead to the improvement of the "race" by ensuring that individuals they deemed of little value would not procreate. Additionally, the whole debate was increasingly framed as a financial one too, wherein, mentally and physically disabled people as well as mentally ill people who were in the care of various institutions and asylums were regarded as "useless eaters", meaning people who would be fed but could contribute nothing to the nation and "race". This discourse was highly popular in Nazi Germany because it fit their conception of "race" and people rather well and was very much in line with their conception of bio politics, meaning the idea that even the presence of certain people within a society – Jews etc. – was a problem in itself that would cause a "decline" of the German people.
As /u/kieslowskifan mentioned in their linked answer, in the 1930s Nazi Germany instituted a program of what they referred to as "racial hygiene" that enabled health courts and other state institutions to mandate the sterilization of people deemed not worthy of procreation – a program that exorbitantly affected the poor and socially marginalized, including f.ex. alcoholics and people who suffered from other, what are now known as, social diseases often brought on by poor and mentally taxing living conditions.
Together with this campaign of racial hygiene, the Third Reich ramped up its propaganda towards portraying people in institutions as "useless eaters" that only cost society money without contributing to it. Images such as this one that portrays a healthy German carrying these people on his shoulders paired with a text that highlights how much it cost to feed and care for someone in an institutions are examples of this kind of propaganda.
There had long been talk among the Nazi leadership about how this "problem" was to be addressed but the outbreak of the war proved a decisive moment in radicalization of policy. Because the leadership perceived it as the start of the ultimate struggle for "racial" supremacy and the final conflict between various races, especially the "Aryans" and Jews, they felt empowered to finally institute measures that would enable to shape German society and demographics in a way that would give them, according to their warped world-view, a leg up in this conflict. Among these measures was to start a targeted program of killing the "useless eaters" in German institutions, hospitals, and asylums for they were perceived as unable to contribute to the winning of the conflict.
After a trial case where a Saxon man petitioned Hitler to be able to euthanize his disabled son, who was killed in 1939, Hitler in October 1939 wrote a memorandum backdated to September 1 to the head of his chancellery, Philipp Bouhler, and his personal doctor, Karl Brandt, that assigned them the task of "empowering certain medical doctors to euthanize people who count as incurably ill under all considerations and after critically reviewing the state of their illness ["dass nach menschlichem Ermessen unheilbar Kranken bei kritischer Beurteilung ihres Krankheitszustandes der Gnadentod gewährt werden kann"].
What followed was the build-up and institutionalization of what has become known in historiography as the T4-Action (T4 after the address of its headquarters, Tiergartenstraße 4) but what the Nazis called the "euthanasia program". Bouhler, Brandt, and Hans Lammers, head of the Reich Chancellery, build a program that consisted of founding a variety of companies intended to camouflage their program such as Gemeinnützige Krankentransport GmbH (Gekrat) responsible for the transport of mentally and physically disabled or the Reichsarbeitsgemeinschaft (RAG) „Heil- und Pflegeanstalten“, responsible for generating lists of those to be killed. With the help of Reich Health Leader, Leonard Conti, they ordered all asylums and hospitals in Germany to generate lists of all patients, who suffered from diseases such as Schizophrenia, Epilepsy, Encephalitis, Chorea Huntington, "feeble-mindedness" or any other neurological condition that prevented them from carrying out "mechanical labor"; people who had been institutionalized for more than five years; mentally ill criminal offenders; and people in institutions who weren't German or of "related blood".
Based on the information collected by these institutions, a panel of three medical doctors designated from a pool of about 40 designated experts was to determine what would happen to these people. In practice, these so-called experts often knowing very little about the patients themselves since all they had was one sheet filled in by the institution that housed the patients in questions, often decided live and death of these patients on very flimsy criteria. Once their fate had been decided by these "experts", the patients in question would under the pretense of bringing them to another institution better equipped to handle them be transported to one of six central institutions that served as killing centers, namely the hospital institutions in Grafeneck, Brandenburg, Hartheim, Sonnenstein, Bernburg, and Hadamar.
Assembled for this very purpose by the Reich Security Main Office and the T4 office, a group of 300 people or so worked in these institutions to ensure the working and proper execution of the killing program. They build gas chambers following a recommendation of the Criminal Technical Institute of the German Police and installed crematoria ovens in these institutions. This was where mass killing by gas chambers was first pioneered by the Nazis, especially in terms of the logistical and methodological considerations as how this was handled would later starkly influence this process in the killing centers in the East (a subject I'll return to), including the famous disguising a gas chamber as showers.
After the patients had been murdered, a special Standesamt (the German state office responsible for recording births, deaths and marriages) that had been attached to these institutions would issue false death certificates stating that the deported patients in questions had died of heart attacks, their lungs giving out and similar causes of death and send them out to their relatives and family.
This centralized T4 killing program was in operation in Germany from 1939 to 1941. During that time more than 70.000 people were killed in these six centers. During this time, the German public gained more and more a sense of what was occurring. People who lived near the centers noticed the distinct smell of human cremation coupled with the strong smoke from the facilities. In Hartheim, the cremated ashes of patients were simple thrown into the nearby Danube, which made it extremely noticeable to the locals. Furthermore, the death certificates sent out to relatives were often faulty, impossible in what they detailed as the cause of death or were sent twice. Lothar Kreyssig was a German judge whose main job it was to be the legal guardian of mentally disabled people unfit to partake in legal exchanges. When he noticed that some of his wards were being killed, the reported it duly to the ministry of justice. The ministry told him that this was occurring on orders of the Chancellery of the Führer and so Kreyssig did what made sense to him: He went to the police to report Philipp Bouhler for murder. While the investigation was killed and Kreyssig retired all these occurrences spread knowledge of what was going on in the German populace.