As I recall, he was initially trying to separate his more trivial works from his serious career as a newspaper coorespondent.
Of course, after he got some popularity, he never made any attempt to hide either part of his identity. Family, friends, and acquaintances all knew him as "Sam" and all his coorespondence, corporate work, and contracts bore the name Sam Clemens or just Clemens, while his books and lecture posters continued to advertise him as Mark Twain.
There's even a funny story where he goes on a riverboat cruise down the Mississippi with his family to give a lecture on board. He's sitting in a lounge chair on deck relaxing and the helmsman calls out "Mark twain!" on the bridge (the call of 12 ft of water under the keel and the origin of the pen name) and his 8 year old daughter comes running up to grab him because everyone's calling for him!