How to trim this cylinder where it meets a box
The Boolean is less destructive, but for a one-off, leaving more options in some cases:


Object Mode, CtrlJ combine the components if not already one object.
Edit Mode, all selected CtrlF Face Menu > Intersect (Knife)
Adjust Last Operation panel > Self Intersect


Followed by removing the faces you don't want, and AltM merging the selection of vertices you want to, By Distance.