A witness is said to be competent to give evidence when that person is legally qualified to testify. There are a number of factors that can affect whether a person is said to be competent. A person may be competent to testify in one instance and incompetent to testify in another.
The most obvious issues having to do with competence are issues of age and mental capacity. A person cannot be competent to testify unless they are sufficiently grown up and have a mental capacity that is sufficient for them to understand what is going on. They have to be able to understand that they need to tell the truth and they have to understand that what is going on is important. They have to be able to remember the events about which they are testifying. For these reasons, it is often the case that children are not competent (though they can be) or that people with mental development disabilities will are not competent.
However, even an adult who is mentally sound will not always be competent to testify. This is particularly true when the testimony involved calls for special kinds of knowledge. For example, let us imagine that I was called to testify at a trial and I was asked if I believed that the defendant (my friend) was a person who was capable of committing the sort of crime for which they were being tried. The prosecution might well object, saying that I was not competent to answer that question because I am not an expert on what kinds of people are capable of various types of crimes. If I were a psychiatrist, I might be competent, but since I am not a psychiatrist, I would probably not be.
Thus, a person is competent to give testimony if they are legally qualified to testify on the issue at hand. This qualification can have to do with age, with mental capacity, or with professional qualifications.