I have hip pain immediately after sitting down on a chair but when I slouch it doesn't hurt, what's going on?

Possible arthritis. You should be evaluated by an orthopaedic surgeon who specializes in the treatment of hip pain. Positional pain such as you describe is often due to an arthritic process. Sitting places the hip in more flexion, and slouchiing, though bad for overall posture, decreases the bendingat the hip. The injury/arthritis is likely in the anterior or front of the hip. Xrays and possibly an mra is warranted.
A couple of things. You may have a mechanical problem within the hip joint such as a torn labrum, or a bone spur, or a loose body. Changing body positions may be unloading the affected area, thus, making you feel better.