"Nice to meet you!"
It can be both actually, depending on what you need in English.
「はじめまして」 (hajimemashite) itself means something like "it's a beginning!" or "it's the first time (we're meeting)!". It's a Japanese thing that doesn't really exist in English as far as I know. Some people translate it as "hello", but you wouldn't say 「はじめまして」 to someone you've met before, that's just awkward, you don't say "Hey nice to meet you" to your friend when you run into him randomly in a store.
「よろしく」is short for 「よろしくおねがいします」. This is another Japanese thing that doesn't have a 1 to 1 equivalent in English. It literally means "I request well". 「よろしい」- it's an adjective meaning "well, good", by replacing the final い with a く you get an adverb which you can use to modify a verb. 「おねがいします」is a verb meaning "I wish, I request". You put 「よろしく」in front of 「おねがいします」and you end up with something that means "I request goodly" or "I kindly request", you get the idea. When you introduce yourself and say that it means something like "Be nice to me" or "Let's be nice to each other" or "Hey let's have a fruitful relationship". It's a Japanese thing. You can also use it when you ask someone to do a favor for you, then it means something like "Thank you in advance".
But if you're doing an introduction, はじめまして is always said first, so it would be something like 「はじめまして、ジョンです、よろしくおねがいします！」
I just want to point out that I entered " よろしくおねがいします " and was marked wrong for it. I'm majoring in Japanese studies at university (I've been using Duolingo to review the basics), and this is exactly what we're taught to use. So this being marked incorrect is a little concerning...
They don't use any indicators in the English sentence to tell how formally it should be translated.
With other phrases, it shortens the English version to show a more casual tone "Thanks" = どもう, "Thank you" = ありがと, and "Thank you very much" can be どもうありがとございます or just ありがとございます
This isn't the case for this greeting. よろしく, はじめまして and all their polite variations are just "Nice to meet you".
I'd been following a personal rule of thumb "When in doubt, be as polite as the options will allow." This is the first time that has let me down
If you're only now noticing the inconsistencies in Duolingo, you're a better man than I am.