In general, one infringes upon a right, whereas one transgresses a limit or, by extension, a rule.
This distinction is not very strong, though; not seldom will you see one word used instead of the other, even to the point of interchangeability.
The lack of a strict distinction can perhaps be explained by the origins of both words. To infringe is from Latin infringo, "to break"; to transgress is from Latin transgredior, "to step over". In both cases, it is easy to imagine carrying out the action on a rule and thereby violating it. Perhaps the present meaning of infringe lies in the idea that in- in infringo should represent "in(to)", as in breaking into a house or walled garden, even though I do not believe this sense pertains to the original Latin verb.