This is a matter of idiom and there's no use attempting to reason about it.
A person to your side is literally beside you.
A person by your side can also be literally beside you, but could also be accompanying you in a friendly, supportive and possibly figurative way.
But a person who is on your side is someone who has decided to be your friend and ally.