how to align object according to specific axes
Answer: Rotate the object you want to change and then apply the rotation.

Explanation

One way to change the orientation of an object is to rotate it and then apply the rotation.

For instance, I create a torus (SHIFT A -> mesh -> torus).



Next I go to the object tab of the properties editor and check Display -> Axis. I don't need to do this to complete the steps, but it makes it easier to see what happens.



As you can see, there is now a yellow axis. You can see 'Z', but 'X' and 'Y' are within the torus



Now, in object mode, I rotate the torus on the X axis 90 degrees (R 9 0 ENTER) The world axis has not changed, but the yellow Z axis now points along the green (Y) world axis.



This is because there are two different coordinate systems.  There is a coordinate system that is shared by all objects. It is called the 'world' coordinate system.

But the second coordinate system is unique to each object. it is called the 'local' coordinate system.  When I move an object in object mode, I move the origin of the object.  When I rotate the object in object mode, I change the orientation of its axes. (Moving and rotating in edit mode do not change the orientation.)

When you add an object in blender, it is positioned so that its local axis align with the world axis.  When you rotate the object, while in object mode the axis changes.

You can apply the rotation. If you do this the object will remain in its orientation but the axis will realign with world axis. (CTRL-A R)



with the result