Мій is used with masculine nouns, моє́ is used with neuter nouns. There's also моя́, used with feminine nouns.
Ukrainian nouns have a gender assigned to them. Sometimes the assignment is meaningful (e.g. words denoting women would have feminine gender), sometimes it is based on the word ending (e.g. almost words in -н would be masculine), and sometimes it's illogical and needs to be remembered.