To my "Western" mind, this little story sounds ridiculous. Somebody turned into a goat? Really? Yet, the Bible talks about miracles; miracles with a purpose... to confirm that that which was spoken by a prophet or apostle of Jesus was the truth. Here is one example.
Acts 19:11-20 (WEB)
11) God worked special miracles by the hands of Paul,
12) so that even handkerchiefs or aprons were carried away from his body to the sick, and the evil spirits went out.
13) But some of the itinerant Jews, exorcists, took on themselves to invoke over those who had the evil spirits the name of the Lord Jesus, saying, “We adjure you by Jesus whom Paul preaches.”
14) There were seven sons of one Sceva, a Jewish chief priest, who did this.
15) The evil spirit answered, “Jesus I know, and Paul I know, but who are you?”
16) The man in whom the evil spirit was leaped on them, and overpowered them, and prevailed against them, so that they fled out of that house naked and wounded.
17) This became known to all, both Jews and Greeks, who lived at Ephesus. Fear fell on them all, and the name of the Lord Jesus was magnified.
18) Many also of those who had believed came, confessing, and declaring their deeds.
19) Many of those who practiced magical arts brought their books together and burned them in the sight of all. They counted their price, and found it to be fifty thousand pieces of silver.
20) So the word of the Lord was growing and becoming mighty.
How do we understand such things in our present day? The answer is a tough one, but to me, God has proclaimed his word and so it just doesn't seem applicable. In the book of Acts, God used people like Peter and Paul to proclaim the new faith and people needed something to have confidence in them, so miracles were necessary. To those who tried to speak in God's name without authority... good luck, you will need it. If you are looking to get better from a disease, take your medicine, see a chiropractor, go on a diet or begin an exercise program... whatever. Only thing is, play it safe.... pet the next goat you meet with kindness... hey, you never know!