Why is coal classified as a sedimentary rock?
I'm not sure why you are including shale in your question, unless you are referring to carbonaceous shale, which in not coal, but shale with carbon throughout the matrix of the shale.

Shale is an argillaceous rock, and argillaceous rocks are "detrital sedimentary rocks" [1]. They are composed of clays and the bedding plane within the shales is "due to the orientation of the clay minerals" [1]. Clearly a sedimentary rock.

Coal however, as you state in your question is derived from organic material - vegetation. The deposition of the vegetation material is analogous to the deposition of minerals that formed sedimentary rocks.

Both materials, vegetation and minerals, were transported to a location. In the case of minerals the transportation may have been a long or short distance and carried out by wind, water or gravity (mudslides). Vegetation tends to travel shorter distances than minerals but like the minerals it has traveled and it accumulates.

Over time the vegetation compacts, is heated, undergoes chemical reactions and experiences a very slow form of metamorphosis and petrification.

Being composed of carbon, coal forms a carbonaceous deposit. Having been transported and accumulated in a single deposit it is sedimentary. Having undergone metamorphosis and petrification it is a rock. Consequently it is reasonable to classify coal as a carbonaceous sedimentary rock.

[1] D. G. A Whitten with J. R. V. Brooks, Penguin Dictionary of Geology, 1979