LOS ANGELES—President Donald Trump’s personal attorney Michael Cohen told a federal court here Wednesday he will assert his Fifth Amendment rights against self-incrimination in a civil case because of a continuing criminal investigation against him in New York.

The filing came in a California civil lawsuit brought by former adult-film actress Stephanie Clifford against Messrs. Trump and Cohen. Ms. Clifford, known as Stormy Daniels, sued to invalidate a 2016 agreement barring her from discussing an alleged sexual encounter...