A common use of the preposition against is to refer to someone or something being in opposition, or in resistance to, another thing. Against in this context often involves a struggle of some kind. For example, if you were pushing something, like a door, you would be exerting physical pressure on it and would be facing some degree of resistance in return. Therefore it would be accurate to say that you are pushing against a door.
Similarly, if you were rowing along a river, and the water current was flowing in opposition to your movement (creating resistance), you would be rowing against the current:
“What he did was against the law.”
“The politician spoke out against gun crime.”
“They played the cup final against their main rivals.”
“She ran against the wind."
You can also use against to express a situation or state of affairs that work in opposition to someone or something, or are unfavourable to them in some way. An obvious example would be someone’s age: “I went for the job, but everyone else being interviewed was much younger than I am. I think my age will work against me.”
As you can see, the theme of someone or something opposing or resisting when using against is still relevant. That is also true when we use it to describe an action taken as a precaution, such as insuring your car against theft or damage, or when you are comparing two things, for example: “The lawyer compared what the man said in court against the statement he made to the police.”