Q:

Why do statutes of limitations exist?

I don't understand: why artificially create a set of deadlines before which one crime or another can be brought to the conviction stage? Why not be able to investigate and prosecute for an indefinite period of time after a crime has been committed? Why encourage criminals to just sit out?

A:

Statutes of limitations go back a long way
The law code of ancient Athens had a five year limitation period except for murder and constitutional crimes. According to Demosthenes, these restrictions were introduced to control sycophants (people who made their living as professional litigators) from bringing unjustified lawsuits in the hope of a lucky verdict.
As then, Statutes of Limitations exist to protect defendants who are, remember, presumed innocent. The principles on which this protection is based are that:

a plaintiff or prosecutor with a valid case should pursue it with diligence,
the older the claim or allegation, the more likely evidence is to be unreliable or lost,
litigation or prosecution of a long-past wrong may result in more cruelty than justice.

Obviously, this is all a matter of degree and different causes of action have different limitation periods.
Most civil causes of action have a limitation period of a few months to a few years which runs from when the plaintiff should have become aware (or from when they attain their majority if they were a child) that they suffered damage. The logic here is that people doing their normal day-to-day activities should not live in perpetual fear that someone from the distant past is going to come out of the woodwork to sue them over an incident they can't remember happened if indeed it did happen. Notable exceptions include claims for damage for child abuse which have a much longer limitation period if they have one at all.
Minor criminal offences usually have a very short limitation period partly as a spur to efficiency by those required to prosecute them and partly because the punishments are small and courts have better things to do with their time then try and sort out the probity of 15-year-old evidence for a speeding offence.
Serious crimes like, murder and sexual assault typically have no statutory limit or they have a limit that can be set aside on application to the court.
For example, in New South Wales the default limitation for civil matters is 6 years, however, it is only 1 year for defamation but 12 years if the action is founded on a deed (among other exceptions).  For criminal matters, summary offences (magistrate's court jurisdiction and maximum 2 years imprisonment) must be must generally be brought within six-months, however, there is no limit on serious indictable offences.

A:

For example, I might have a perfect alibi that proves I did not commit some specific crime. If twenty years from now I’m accused of this crime, I would have completely forgotten about the alibi, the witnesses seeing me in a different place would have forgotten, and only in the rarest situations would they remember the date. 
So having a fair trial would be very difficult, since I cannot defend myself after that long a time. If I actually committed some crime around that time, but not the one I’m accused of, I might not even remember for sure whether I committed the crime or not. 

A:

Let's say that at the age of 21, you go and do something stupid, but aren't charged with anything. 25 years later, you run for President. Do you think a prosecutor should be able to haul you in for that decades-old crime?
If it was, say, a murder, then the answer is yes. But what if it were more like a drug crime that they can only prove because you give some excuse about not inhaling at a press conference?

why artificially create a set of deadlines before which one crime or another can be brought to the conviction stage?

It doesn't have to be brought all the way to the conviction stage in that time frame. It only has to be charged. It's not a violation of the statute of limitations if the trial happens to go past the limit.

Why encourage criminals to just sit out?

I'm not quite sure what you mean by that. But if an alleged criminal goes into hiding or leaves the jurisdiction, the statute of limitations generally "tolls" until they stop hiding or come back.

