We are not actually told by The Bible why the Holy Spirit descended upon Jesus as he prayed after being baptized. We can therefore only think about why it makes sense for it to have done so. The best answer to this is that the Holy Spirit descended upon Jesus to formally mark the beginning of his ministry and to act as a sign to all present that Jesus was not an ordinary prophet.
The people at Jesus’ baptism would not have had any idea of who he was so far as we know. He had not been a public figure up until this time. Therefore, it would have been logical (from our point of view) for God to somehow give a sign to all the people that Jesus was his son. By sending the Holy Spirit down in a form that could be seen, God was telling everyone present that Jesus was not an ordinary preacher.
The descent of the Holy Spirit also, along with Jesus’ baptism, marks a formal beginning to his ministry. This can be seen as a sign of Jesus accepting the task that God has given him, regardless of what the end result will be.