A man who wore a T-shirt with a protest slogan has become the first to be jailed under Hong Kong's new national security law.