With a two-sided test, you should always look at both tails of the distribution. It just so happens in this example that looking at one tail gives the correct p-value. This is because the observed value of 2 is really small.
More generally, though, you should add all probabilities precisely for those values of Y with probabilities (under the null hypothesis) not exceeding the probability that Y = 2. The following R code provides this calculation:
null_distribution <- dbinom(x = 0:15, size = 15, prob = 0.6)
prob_of_observed_value <- dbinom(x = 2, size = 15, prob = 0.6)
(index_with_equal_or_less_prob <- which(null_distribution <= prob_of_observed_value))
#> [1] 1 2 3
# these are the probabilities corresponding to Y=0,1,2
dbinom(x = 0:15, size = 15, p = 0.6)[index_with_equal_or_less_prob]
#> [1] 1.073742e-06 2.415919e-05 2.536715e-04
sum(dbinom(x = 0:15, size = 15, p = 0.6)[index_with_equal_or_less_prob])
#> [1] 0.0002789044
Created on 2021-11-02 by the reprex package (v0.3.0)
If the observed value was 3, we immediately see that we must also include $P(Y = 15)$:
null_distribution <- dbinom(x = 0:15, size = 15, prob = 0.6)
prob_of_observed_value <- dbinom(x = 3, size = 15, prob = 0.6)
(index_with_equal_or_less_prob <- which(null_distribution <= prob_of_observed_value))
#> [1] 1 2 3 4 16
dbinom(x = 0:15, size = 15, p = 0.6)[index_with_equal_or_less_prob]
#> [1] 1.073742e-06 2.415919e-05 2.536715e-04 1.648865e-03 4.701850e-04
sum(dbinom(x = 0:15, size = 15, p = 0.6)[index_with_equal_or_less_prob])
#> [1] 0.002397954
binom.test(3, 15, 0.6)
#>
#> Exact binomial test
#>
#> data: 3 and 15
#> number of successes = 3, number of trials = 15, p-value = 0.002398
#> alternative hypothesis: true probability of success is not equal to 0.6
#> 95 percent confidence interval:
#> 0.04331201 0.48089113
#> sample estimates:
#> probability of success
#> 0.2
Created on 2021-11-02 by the reprex package (v0.3.0)