The institution is perhaps the most recognizable, enduring, and terrifying symbol of mental illness in popular culture. Whether a character is sent to the funny farm, madhouse, loony bin, asylum, or a plain old mental institution, consumers of pop culture know exactly what to expect. Padded walls, straitjackets, screaming patients behind locked doors, and depressing or creepy scenes, depending on the genre. Perhaps patients will amble zombielike through the day room, zoned out on pills. The crazies contained therein howl and drool and mutilate themselves, loom in the hallways to terrify the main character, whisper harsh warnings after lights out. Maybe the patient will be subjected to horrific psychiatric experimentation that turns her evil. And oh yes, it's usually a her.
Asylums are ancient; by the fifth century CE, many societies were isolating people with symptoms of mental illness in facilities designed primarily as warehouses to keep them out of public spaces. The infamous Bedlam asylum was founded in the 13th century, housing at first a handful of "lunatics." The asylum really started to come into its own with the 18th century, and in some cases these facilities were closely tied in with the poor laws that were used for social control of low income people in society.
The 19th century brought about a shift in the framing of asylums in the public eye. While they had traditionally been designed as facilities for the "care" of people with mental illness, many failed to have a rehabilitative aspect and people could be trapped in them indefinitely. Reformers pushed for rehabilitation and release, as well as more humane treatment, even as the numbers of people sent to such facilities began to rise. Many of those people were not mentally ill at all, but were simply undesirable; pregnant teens with no husbands, for example, or troublesome female relatives who spoke their minds. Some had intellectual and cognitive disabilities, rather than mental illness, and received inadequate care as society shifted from a culture where people were supported at home to one where disabled and sick relatives were hidden away. Sisters and brothers might disappear overnight, never to be seen again.
With the rise in the numbers of patients came corresponding rises in abuses, some of which were perpetrated in the name of rehabilitation. Psychiatric patients were subjected to torments like water dropping, lobotomies, and solitary confinement. In the 20th century, tools like insulin comas and electroshock therapy came into prevalence, along with sterilization. Needless to say, informed consent for these activities was not considered necessary because they were done for the "benefit" of the patient. The scenes in mental health facilities could be grim indeed. Some of these "treatments" persist to the present day.
Even now, some mentally ill people are denied agency through capacity laws. In a capacity hearing, people debate the patient's ability to make decisions, to understand medical issues, to reenter society. At the hearing, the end ruling may be that the patient lacks capacity and needs a guardian, a person who will have the power to make decisions on the patient's behalf, without consulting the patient. This can include permanent institutionalization, if the guardian thinks it is necessary.
Despite documenting abuses in the institutional environment in a way that might seem like a condemnation of institutionalization, pop culture often makes a point of separating out the hero from the actual crazy people. They may drift through the narrative as sources of inspiration and general interest; think of the Wise Crazy Person who advises the hero while he is trapped in the mental hospital, or the Gentle Suicidal Girl who makes the lead character sad when she finally succeeds in taking her own life.
In pop culture, the asylum is a frightening place because it is filled with crazy people. The theme of "sane" person condemned to a mental institution arises again and again in pop culture. We see things like the capacity hearing abused to make sure that our character is powerless, for instance, we see psychiatrization used as a political tool to lock someone up. What we don't see is a challenge to the institutional system itself; often the underlying story is that institutionalization is a problem only when it happens to characters who are not mentally ill.
The asylum is shorthand, a symbol creators of pop culture can quickly slot in when they want to quickly convey something that will be almost universally understood, even by consumers who are not familiar with the history of mental health facilities. Familiarity with the history would actually spoil the image; the underlying idea is that such facilities provide a needed service in the form of helping mentally ill people, but it's bad when "normal" people endure the environs of the asylum because they don't need treatment.
Familiarity with what life is actually like in institutions might also ruin the image. The conditions in real-world mental health facilities are highly variable. Not many fulfill the cartoon caricature seen in pop culture; many are in fact very ordinary, dull sorts of places where patients receive inpatient therapy and support. Others may be everything you have imagined in pop culture—and worse—because that nonconsensual electroshock "therapy" is happening to a real person.