In Avengers: Age of Ultron, we saw that
Just after his birth, Vision jumped on Thor.
Why did he attack despite being a good guy? Also, why did he choose to attack Thor?
Actually he says something else. He says,
That was... odd.
Imagine you just came to life. There's a dude in front of you who looks quite threatening. Vision has a "human element" inside him (as mentioned by Dr. Banner in Avengers: Infinity War, "Vision is made of many parts. Me, Tony, Ultron, the Gem..."), so that human element could have reacted without thinking (classic humans) and attacked instinctively.
Once Thor throws him away, and he sees the outside world, he comes back to his senses, acknowledges it to Thor (by saying 'that was odd') and thanks him for powering him to life.
Ultron started uploading his consciousness into the body that was ultimately used for Vision, so it's possible that there was part of that lingering in there even though he didn't complete the process. Vision does say something to the effect of "Thanks for that." after Thor hits him, which indicates that he may not have been in his right mind and has now been snapped out of it.
Having only seen the film once so far, I'm not going to speculate on why he attacked Thor specifically. It could have simply been that he was the first available target, I don't know.