When a 2D block is inserted into a wall, it rotates to align itself with the wall. The direction of the rotation depends upon the direction in which the wall was drawn; the top of the block will align to the right side of the selected wall. (The right side is determined by facing the wall's start point from the end point.)
Note: This method of inserting blocks applies to 2D blocks, and 2D (plan) representation of walls. To create walls and doors that you can see in 2D as well as 3D, see Openings.