WASHINGTON—President Trump used his Twitter account to share a post naming the alleged whistleblower whose complaint set off the congressional investigation that led to his impeachment.

Late Friday night, Mr. Trump’s Twitter account retweeted a tweet by a user named “Surfermom77” that identified the alleged whistleblower.

The...