How to get an attachment description in WordPress
wp_prepare_attachment_for_js(get_the_ID())['description']
Can be used to get any of the details of an attachment, not just description.
Documentation: developer.wordpress.org/reference/functions/wp_prepare_attachment_for_js