The family was in conflict with another Perast family of Bujović, and after Vicko Bujović was killed in a fight on city streets, Matija was forced to leave Perast for alleged involvement when he was 28. He escaped to the Republic of Ragusa (Dubrovnik) and then to Istanbul, where he found refuge with Russian ambassador Peter Tolstoy. In 1712, Tolstoy sent him with a recommendation to Peter I.
He arrived in Russia in 1712 and was enlisted in the galley fleet as a captain of the 1st rank. Since 1714 the head of the galley fleet in the Baltic, the participant of the battle of Gangut.
Since 1721, a member of the Admiralty Board, led the construction of the galley Harbor in St. Petersburg. In 1723-1724 he headed the construction of ships at the Tavrov shipyard.
Since 1725, the commander of the galley fleet and chief commander of the St. Petersburg port. In 1728, on denunciation for the use of state funds, he was tried, sentenced to death, pardoned, demoted to vice-admirals and appointed commander of the Astrakhan port.
In September 1728 he was appointed chief commander of Tavrov, arrived there in July 1729 and headed the local Admiralty. Because of delayed assistance in the construction of the fleet he had a conflict with the Governor V.P. Izmailov and Vice-Governor E.I. Pachkov.