How to make an rod to rotate with another rod both have pivoting point at the origin
There's no need for Animation Nodes, here, unless you have reasons. You can used a Locked Track constraint on the red arrow.
Here, an Empty has been parented to the tip of the green arrow, for the red arrow to follow. The red arrow has been given a Locked Track constraint as follows:

.. so it points its own X axis at the Empty, while constrained to the plane whose normal is its own Z. (Apologies for the axes not being the same as yours, you'll just have to swizzle them). The green arrow is free to rotate...

...the red arrow points in the direction of the green arrow's projection onto  the red arrow's XY plane.