The first appearance in court is your arraignment. The judge will tell you what the charges are against you and that is when you enter your "not guilty" plea. The clock starts ticking on certain speedy trial rights you have at that point. If you continue your arraignment for some reason (to hire an attorney, for example), your rights don't start until you actually enter your not guilty plea.
If you were charged with a misdemeanor, you have a right to a jury trial on your charges within certain times from your first appearance in court when you enter your not guilty plea. If you were in custody at the time of your arraignment, you have a right to a trial within 30 days. If you were out of custody, you have a right to a trial within 45 days.
In a felony case, there is an intermediate stage before trial - your preliminary hearing. You have a right to a speedy preliminary hearing - within 10 court days from your arraignment and not guilty plea. If you waive or give up that 10 day right, you still have a right to have your preliminary hearing within 60 calendar days of your arraignment.
After a preliminary hearing
If you are fighting felony charges and have your preliminary hearing, your clock starts over in a different set of proceedings.
If you were held to answer (told there was sufficient evidence for you to stand trial), then the prosecution will file a new charging document against you within 15 days of your preliminary hearing. You will then appear in court to enter another not guilty plea to the charges filed in a document called an "information."
Felony speedy trial rights
From the date of the entry of a not guilty plea to the charges in an information, you have a right to a trial within 60 calendar days. You can agree to "waive time" and set your trial beyond that period. If you do, you have a right to a trial on that date or within 10 days of the date you set. The date you set is "day zero" and the following day is "day one."
For example, if you are arraigned on your information on July 1, you have a right to a trial within 60 days. If you waive time and set your trial for October 15, you have a right to a trial on October 15 or within 10 days of then (10/15 is day 0, 10/16 is day 1, etc.)
When does a trial "start" for speedy trial rights?
Your trial has "started" if it is assigned to a court and the judge devotes his or her attention to your case in a significant way. They may handle routine matters at the start of the day or at recesses, but your case takes priority.
If a judge begins hearing your case, whether it be pre-trial motions, jury selection or other initial matters that must be handled before the evidence begins, your trial has still "started" for the purpose of speedy trial rights.