At 5’7 I’d recommend a medium in most bikes, or potentially a reach measurement of around 430 to 450mm. The best thing would be to visit an LBS and try a few out, especially if it’s your first ever MTB.
Unless you’re planning to race then an XC carbon hard tail may not be the best choice - you might be better off buying an aluminium full sus instead. They tend to be more forgiving for beginners.