Please, look the consonant mutation rules on duolingo turkish gramar portal or there: https://www.turkishexplained.com/conmut.htm and there: https://www.turkishexplained.com/Turkish-Consonant-Mutation.htm
xandria, Ektoraskan gives us an excellent explanation in his comment above. I hope you can read it. Should read all the comments, you'll always find an answer to your questions. I do that since the beginning. Very hepful. No teacher here but only more or less advanced learners and contributors who give explanations when they can.