The way to judge if it is a coincidence is to assume that they really are completely unrelated and calculate how strange the luck would be to get the results you got. The assumption that they are unrelated is called the "null hypothesis". This is a typical example of the most common application of probability. There are some standard levels of probability that are typically used before one would conclude (with the selected probability) that the null hypothesis is wrong. They are .05, 0.025, 0.01. They are called "confidence levels" of 95%, 97.5%, and 99%, respectively. Sometimes an extremely strict level is used. For example, before a nuclear physicist can claim that he has found a new particle, he must show that the probability of having his results would be less than 1 in 3,500,000 chance (probability=0.0000002857) if it was not a new particle. This is called a 5-sigmas criteria. 5-sigmas corresponds to around a 1 in 3,500,000 chance.
In your example, you say that A and B always show the same result. At the 0.05 probability level, it would require 5 experiments, all with the same results, to conclude with 95% confidence that they are related. Here are some other probability levels and the number of identical results that would be required:
0.05 5
0.025 6
0.01 7
1/3,500,000 = 0.0000002857 20