Problem: First of all, the Bible describes Jesus as God (John 1:1) who has, with the Father, “all authority in heaven and earth” (Matt. 28:18). However, on this occasion Jesus “could do no mighty work there” (v. 5). Why couldn’t He, if He is all powerful?
Solution: Jesus is almighty as God, but not almighty as man. As the God-man, Jesus has both a divine nature and a human nature. What He can do in one nature He cannot necessarily do in the other. For example, as God, Jesus never got tired (Ps. 121:4), but as man He did (cf. John 4:6).
Furthermore, just because Jesus possessed all power does not mean that He always chose to exercise it. The “could not” in Mark 6:5 is moral, not actual. That is, He chose not to perform miracles “because of their unbelief” (6:6). Jesus was not an entertainer, nor did He cast pearls before swine. So the necessity here is moral not metaphysical. He had the ability to do miracles there and in fact did some (v. 5), only He refused to do more because He deemed it a wasted effort.