Biography
So you're a bona fide scientific genius, and you've come up with a wonder drug that will allow people to live forever. So now you'll apply for approval from the FDA, right? Begin animal testing, assessing major organ toxicity in rats and small primates, then monitoring the subjects for carcinogenic effects and reproductive complications; who knows, if the drug behaves as predicted you could be doing Phase One clinical trials inside of five years.
Or, you could just mix up a batch of the stuff in your basement and drink it...
That's just what scientists do in fiction. They might go as far as trying out their incredibly experimental drug/strength ray/time-altering device/etc. on a squirrel or something first, but the point is that they move onto human testing quickly, usually without any safeguards or anyone observing, and they use themselves as a test subject. They might have their reasoning — they needed to get it done quickly because the invention is needed for some time-sensitive purpose (e.g. a dying loved one, a company about to go under); the story's setting (such as After the End) inherently limits the options in terms of test subjects; they're a discredited scientist, forced to work under the radar; the invention is being created not for public consumption but for the scientist's own (usually evil) ends; or the scientist is just plain crazy. But none of those are decent reasons, save possibly the insanity; it's just a dumbass thing to do. Hence the fact that half the time something Goes Horribly Wrong; and for the other half (which is far worse) something Goes Horribly Right.
On the other hand, these characters usually retain the audience's sympathy since they are risking only their own lives, not those of some poor Innocent Bystanders or their own children. This puts them in favorable contrast to the Obviously Evil Mad Scientists, who test their Phlebotinum on any innocent humans they can strap down to the table.
Testing things on themselves is actually terrible scientific procedure. Since the scientist has pre-conceived notions on what might happen the results are unreliable and are likely to be discarded. There's also the issue that there can't be a control group due to the testee/tester knowing what they are doing. Many experiments don't tell the testees what they are trying to find out or lie to them in order to find out something different from what the scientists are claiming to find.
The more cartoonish the show, and the crazier the scientist, the more blatant this trope becomes. A Zany Cartoon might very well feature a scientist who, suddenly needing to be giant, just steps over to his array of beakers and retorts, mixes a bunch of funny-colored liquids together, and drinks it.
Believe it or not, this was actually standard procedure in many fields of science. Even as late as the 1950's, chemists would create a new compound and ingest it to see what it did. It was not the healthiest of occupations; quite a few scientists did end up killing themselves via experimentation. The Nuremberg Code of 1946, which codified the ethical requirements for human experimentation, forbids any experiment that is highly likely to or will certainly cause death or serious harm to the subjects. However, the ban is explicitly waived if the researcher is experimenting on himself. It still happens; see the real-life example section.
See also No Control Group. May overlap with Self-Made Superpowers, if the purpose (and result) of the experiment was the character gaining superpowers. May also overlap with Getting Sick Deliberately, if the character decides to test something by getting themselves ill first.