This is more an extended comment than an answer, and anyway this is a stretch as there are certainly missing or confusing information in the instructions and answer key. However, one possibility is that they might be using the Neyman's modified $\chi^2$ statistic. But again, this is a stretch.
I'm going to assume a goodness-of-fit test here, but I think it would hold for a test of independence or homogeneity given a sufficiently large number of observations in group B. The Neyman-modified $\chi^2$ statistic can be computed as*:
$$\chi_{Neyman}^2 = \sum_{i=1}^k\frac{(O_i -E_i)^2}{O_i}$$
What makes this statistic different from the Pearson's $\chi^2$ statistic is that the observed values go into the denominator, instead of the expected values. This could make it possible to reach a statistic of 7.61 and a p-value of 0.0058, as shown a few paragraphs below. However, this is making several assumptions, possibly incorrect, about the instructions and answer key you were given.
This is certainly a stretch, because:
- There is nothing in the instructions saying explicitly they use the Neyman-modified $\chi^2$ statistic. Some notations I've seen include $\chi_{Neyman}^2$ , $NM^2$ , or $\chi_{mod}^2$ , but not
c^2. In my field (sociology & political science), my experience is that it's much more common to use the Pearson's $\chi^2$ statistic (or a binomial test), and in fact I have yet to see one of my colleagues use the Neyman's alternative. So I would expect some sort of notice or warning when an alternative to Pearson's $\chi^2$ statistic is used. That being said, perhaps the Neyman $\chi^2$ is more common in your field or research community. - A $\chi^2$ statistic equals to $7.51$ doesn't yield a p-value of $0.0058$ for 1 degree of freedom, as others noted in comments. However a value of $7.61$ does. It hints to some mistake or typo in the instructions. If it's indeed the case, I think we can only make assumptions about all the values they meant, and these assumptions could be incorrect.
- It is assuming that the proportion $0.58$ is rounded, but nothing in the instructions say that explicitly. If it is not rounded, then the Neyman $\chi^2$ statistic cannot reach $7.51$ or $7.61$, but only about $7.46667$. Consequently, this would not explain the values you have, making this very answer completely irrelevant.
Now, assuming the proportion $0.58$ indeed comes from a rounding operation, the Neyman $\chi^2$ can reach a value of $7.61$ if the proportion of expected "yes" equals $0.5826747$:
$$\chi_{Neyman}^2 = \frac{(6 - (20 \times 0.5826747))^2}{6} + \frac{(14 - (20 \times (1-0.5826747)))^2}{14} = 7.61$$
Conversely, the $\chi^2$ statistic and the p-value could have been rounded, so the proportion of "yes" in group B might not be exactly 0.5826747. At first glance, it seems that values close to it, at the fourth or fifth decimal place, would be plausible candidates.
*As a side note, the Neyman's version of $\chi^2$ is a special case of the Cressie-Read power divergence statistics, with $\lambda =-2$. You can find software implementations in the R package philentropy, or the scipy library in Python. Other statistical software probably offer similar features.