The best stretches for hip flexors are variations of the standing lunge. The basic version looks like this:
The two main components to get the most out of it, if the goal is stretching the hip flexors, are: extension of the hip (putting the leg far behind) and flexing the back.
Yoga is great for a start. Most versions of yoga 'sun salutes' include everything you need to counterbalance the effects of prolonged sitting. I'd use every opportunity to do some stretching because 8 hours a day of sitting is a lot to compensate for. If it's not possible to do a full set of sun salutes in the office, just stand up at least once in every hour, it will make a big difference.
To understand the anatomy you need to know which muscles are involved, where they attach, and what they do. To stretch, the attachments must move farther away from each other.
Take for example the psoas major, it flexes the hip, extends the lumbar spine, and bends the trunk, so if you want to stretch it, do the opposite of each action, ie. extend one hip, flex the spine, and bend in the opposite direction (lift the same arm as the leg extended), which will look something like this: