For a new rider I'd suggest a hardtail 26" (unless you're like 6'-6" or taller). You should be able to find some decent used bikes on Craigslist etc. Look for well known brands - Trek, Specialized, Giant etc. DO NOT buy any department store bikes - they LOOK like a mtb but they are NOT.
A decent hardtail will give you a chance to learn the skills you need for riding XC. Then you can see if you feel like you need to invest in a better bike to explore a different niche - or not. I started on a HT 26'er and have stuck with it.
Good luck.
Steve Z