Attaching one face to another
You can use either Boolean modificator (in Object mode) or Intersect tool (in Edit mode). 


Start with cylinder passing through cube.
Cube and cylinder have different amount of vertices, hence cube should be edited in order to have roughly the same shape as cylinder has. It is possible to skip this and create intersection as is, however this way will create Ngons which may be undesired.
One way to change cube accordingly is to bevel it. Select it and press Ctrl+B, 2 segments, low value of Offset. 


Add 1 loopcut per both sides of the cube. Use Connect Vertex Path (J) tool to connect corner vertices.


Select all, in 3D Viewport header choose Mesh > Faces > Intersect tool and in its options (Last Operator panel in the Toolshelf or F6) select Self-Intersect. 


Select all again, press W, choose Remove Doubles. Note that you may need to enter higher threshold for Merge Distance, like 0.02.