Basics! How to get rid of protruding face that overlaps another object
If you want to make a box with a roof, you can simply

add a cube
loop cut and slide it in the half like this:



select the middle top edge and move it upward