You have to pay tax and a 10% penalty on the earnings portion of a Roth IRA withdrawal if either of the following apply: (1) you're under age 59 1/2 when you receive the distribution, or (2) you haven't met the required five-year holding period.
The holding period is a once-in-a-lifetime metric that begins on the date of the first Roth IRA contribution and includes all Roth IRAs you may have; subsequent contributions to any Roth IRA don't restart the clock.
With a Roth, any distribution is considered to have come first from your contributions, and then from earnings. So any tax & penalty for a non-qualified distribution is calculated only on the earnings portion.
The IRS does allow for exceptions to the early withdrawals penalty (see here https://www.irs.gov/taxtopics/tc557.html).