He didn't play cricket because of Tim.
This can have two meanings, as explained by @George K in his answer. To avoid having ambiguities, we could in a conversation use various intonation, or in written form rephrase the sentence in various ways.
If we want to retain the words and their order for whatever reasons, we could use punctuation to make this differentiation.
Usually, if a dependent clause follows an independent one, commas are not used to separate the clauses. Possible exceptions are in sentences with negative clauses.
In OP's example, placing a comma before because clarifies that the subject did not play cricket.
He didn't play cricket, because of Tim.
OP's suggestion also works and clarifies that the subject did not play cricket.
Because of Tim, he is not playing cricket
Master Class explains further.
I’m not going to New York because the weather will be cold.
Placing a comma before “because” clarifies that, as a result of the weather being cold, the speaker is not going to New York. Without a comma before “because,” the sentence could indicate that the speaker may be going to New York for a reason other than the cold weather.