If you've never done gym/worked out before, I'd recommend a full body workout with lighter weights initially, so that you get an all-round workout, build your endurance slightly and for your body to get used to the movements. Once you've reached a level where you find it hard to get a good quality focused workout by doing a 'bit of everything', then I think it makes more sense to split and focus on individual muscle groups then.
But there are different techniques. Depending on your endurance & general fitness levels, you could cram an intense full-body workout that totally burns out most of your muscle groups, into just 30 minutes (in contrast to how you see some people in the gym for 2 hours, but taking 5 minute breaks in between exercises). It's worth trying different things to work out what suits you best. It depends how much time you've got in a day, how many days per week you're prepared to work out, and how many recovery days you want to have.
People that are new to working out can often get 'obsessed' with a very narrow range of exercises that fall within their comfort zone. They will focus on very specific muscle groups over an over, superficially appearing far stronger than they actually are. For instance, being able to curl 50kg with a barbell doesn't mean you're 'strong', if you can't even do it standing up because your lower back buckles under the weight. And it's not even good for you. That's why I'd recommend a full-body workout initially.