The thru axle shares a similarity to a QR sqewer in that it effectively squeezes the drop outs to the hubs lock nuts and/or end caps. Rather than threading into a separate nut on the outside of the drop-out, the fork or rear of the bike has to accept the threads of thru-axle.
The removable part in a thru axle hub, like a QR skewer, slips thru the center of the actual axle.

Note that in this diagram, the center tube--the thing many call the thru-axle--is not shown. The axle in the picture (part of the thru axle assembly)is held in place with a locknut on the nondrive side. One must loosen that to remove the axle out that side. The right side has an end cap that can be removed by hand, as can the freehub body. Note the position of the sealed cartridge bearings (#5 in diagram). These are designed with 2 races, an inner and outer race that sandwich the ball bearings. The seals close the gap between the inner and outer races. The inner ring or race is held captive by the pressure exerted by the inner thru axle transferred upon the face of the inner race. The outer race is an interference fit (press fit) into the hub, effectively becoming one with the hub shell. Now the outer axle (pictured) goes thru both bearings as a slip fit--the fit is tight in the hole of the inner race but obviously you can remove it be hand. When the dropouts are squeezed by the inner thru axle, they are forced against end caps of the outer thru axle. This creates a situation where neither the inner nor the outer axle rotates as the wheel turns, but rather the hub, connected inside by press fit to the outer race of the bearings and outside by spoke tension to the rim, rotates with the rim and outer bearing race around the thru axle assembly (the outer axle, inner bearing race and the squeezing inner thru axle) is stationary.
The necessarily tight tolerances of this system doesn't allow much room for misalignment (ideally the bearing faces are perfectly parallel) or play (slight movement off of the perpendicular plane of rotation). Misalignment causes premature wear to the cartridge bearing. Even in a good quality system, after some time one can see where the inner race of the bearings make a mark on the outer thru axle as the miniscule amount of necessary play between the bearing races cause the metal of the axle to become shinier where the inner race frets the metal of the outer thru axle.