There was never a person called Malachi. The Book of Malachi was written anonymously. probably in the early post-exilic period. Verses 3:1-4 refer to 'my messenger' (Hebrew:
mal'aki) and it is this reference that gives the book its name: Malachi.
Answer: The Bible doesn't go into great detail as to the history of the calling of all of its prophets as it does, say, for Moses. But, in all cases, they are "called by God."
"All scripture is given by
inspiration of God..." (II Tim.3:16). The book of Malachi is scripture. So, God inspired Malachi to write.
for prophecy never came by the will of man, but holy men of God spoke as they were moved by the Holy Spirit. [NKJV]