I came to the U.S. from Japan as a tourist, and didn't leave after my expiration date. I've been here for about three years since, working as a nanny and waitress. I recently read that people from Japan are eligible to enter the visa lottery. Can I enter even though I'm here illegally?
Anyone who is from an eligible country (which Japan is) and meets the educational and financial requirements can enter the visa lottery. (See Winning a Green Card Through the Visa Lottery for details.) But the real question is, what happens if you win? People living in the U.S. illegally are rarely able to succeed in a green card application, no matter what basis they're applying on.
This is because, for the most part, only people who are currently in lawful status in the U.S. can apply for the green card using a procedure called "adjustment of status," meaning they take care of all the paperwork and their green card interview at a local office of U.S. Citizenship and Immigration Services (USCIS).
Everyone else must leave the U.S. and complete their green card application at the U.S. consulate in their home country. However, if you have been unlawfully present in the United States for more than one year while over the age of 18 (and after the date of the law's enactment on April 1, 1997), the consulate can forbid you from returning to the U.S. for ten years. See Consequences of Unlawful Presence in the U.S.: Three- and Ten-Year Time Bars for more information.
A waiver of the unlawful presence bar is available, but you'll need to have close, "qualifying" relatives in the U.S., who would suffer hardship if you were denied the visa, in order to succeed in obtaining the waiver and getting a green card. There is some good news, however, if you happen to have qualifying relatives: In the past, lottery winners were not eligible to apply for the "provisional waiver," which would allow getting an answer to one's waiver request before, not after leaving the U.S. for one's consular interview. But as of 2016, they way apply for the provisional waiver. (See Who Is Eligible for Provisional Waiver of Three- or Ten-Year Time Bar.) This is a huge benefit; it can avoid you being trapped overseas for ten years because the consulate chose to deny your waiver request.
Various exceptions also exist to the above rules, depending on the details of your personal situation: For example, a very few people still have the right to adjust status in the U.S., under an old law called Section 245(i), usually because someone started the process of getting them a green card long ago. And some people who might think of themselves as living here illegally are actually not "unlawfully present," such as some students who dropped out but whose cases haven't been examined by the immigration authorities.
You should really see a lawyer for a full analysis. Also, for more information on the green card lottery, pick up a copy of U.S. Immigration Made Easy, by Ilona Bray (Nolo).