It's a tough question to answer without actually seeing you squat. Realize that injury is almost always a result of some type of dysfunction, so provided that there wasn't a specific point that you injured it, it's very likely a form issue. Is the pain present if you squat with say, bodyweight only, or is it present only with heavy weight? Regardless, I'm betting that it's very likely tied to a flaw in your technique. The cause could be any number of things:
1) never learned properly
2) picked up a bad habit recently
3) lack of mental focus
4) too much mental focus (overthinking it)
5) bad footwear
6) another pain that leads to altered form
7) something completely unrelated to training (excessive sitting, etc.)
That's just a few ideas to give you some things to consider. Hopefully if you think about it, you can figure out what's causing this.
While that may be good for treating the symptoms (hip pain), it's important to identify and correct whatever the cause is.